Merge pull request #4001 from jeffreyguo/patch-2

* jeffreyguo-patch-2:
  Update 01_Data_Model_and_ORM.md
This commit is contained in:
Loz Calver 2015-03-19 21:19:24 +00:00
commit 098be055a9

View File

@ -409,7 +409,7 @@ And removing Sig and Sam with that are either age 17 or 43.
'Age' => array(17, 43) 'Age' => array(17, 43)
)); ));
// SELECT * FROM Player WHERE ("FirstName" NOT IN ('Sam','Sig) OR "Age" NOT IN ('17', '74)); // SELECT * FROM Player WHERE ("FirstName" NOT IN ('Sam','Sig) OR "Age" NOT IN ('17', '43'));
You can use [SearchFilters](searchfilters) to add additional behavior to your `exclude` command. You can use [SearchFilters](searchfilters) to add additional behavior to your `exclude` command.
@ -548,7 +548,7 @@ The data for the following classes would be stored across the following tables:
- LastEdited: Datetime - LastEdited: Datetime
- Title: Varchar - Title: Varchar
- Content: Text - Content: Text
NewsArticle: NewsPage:
- ID: Int - ID: Int
- Summary: Text - Summary: Text
@ -558,7 +558,7 @@ Accessing the data is transparent to the developer.
$news = NewsPage::get(); $news = NewsPage::get();
foreach($news as $article) { foreach($news as $article) {
echo $news->Title; echo $article->Title;
} }
The way the ORM stores the data is this: The way the ORM stores the data is this:
@ -575,7 +575,7 @@ example above, NewsSection didn't have its own data, so an extra table would be
* In all the tables, ID is the primary key. A matching ID number is used for all parts of a particular record: * In all the tables, ID is the primary key. A matching ID number is used for all parts of a particular record:
record #2 in Page refers to the same object as record #2 in `[api:SiteTree]`. record #2 in Page refers to the same object as record #2 in `[api:SiteTree]`.
To retrieve a news article, SilverStripe joins the [api:SiteTree], [api:Page] and NewsArticle tables by their ID fields. To retrieve a news article, SilverStripe joins the [api:SiteTree], [api:Page] and NewsPage tables by their ID fields.
## Related Documentation ## Related Documentation