21306 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1038 Views |
-
Default data structures on build

18 February 2009 at 4:41pm
Hi all,
Is it possible to provide a set of sample data (ie, as yml) that will automatically be loaded on dev/build? The test runner does this, just wondering if it is possible for normal projects.
This would be great for populating certain objects when the database is built.
-
Re: Default data structures on build

18 February 2009 at 5:54pm
requireDefaultRecords() is run on each DataObject when the DataObject is built - so you could just do something like:
public function requireDefaultRecords() {
if(!DataObject::get_one('PageType')) {
$pageType = new PageType();
// ...
$pageType->write();
}
} -
Re: Default data structures on build

18 February 2009 at 9:25pm
Cheers AJ, that's the sort of thing I'm looking for.
| 1038 Views | ||
|
Page:
1
|
Go to Top |


