mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Update 01_Data_Model_and_ORM.md
This commit is contained in:
parent
2d1fa46be8
commit
e0627c7148
@ -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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user