Merge pull request #58 from oddnoc/safe-sitetree

Make SiteTree reference conditional in InitProcessor
This commit is contained in:
Ingo Schommer 2014-08-02 17:54:20 +12:00
commit bf36edecad

View File

@ -197,13 +197,15 @@ class FeatureContext extends SilverStripeContext {
$factory->define('Member', $blueprint);
// Auto-publish pages
foreach(\ClassInfo::subclassesFor('SiteTree') as $id => $class) {
$blueprint = \Injector::inst()->create('FixtureBlueprint', $class);
$blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) {
$obj->publish('Stage', 'Live');
});
$factory->define($class, $blueprint);
}
if (class_exists('SiteTree')) {
foreach(\ClassInfo::subclassesFor('SiteTree') as $id => $class) {
$blueprint = \Injector::inst()->create('FixtureBlueprint', $class);
$blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) {
$obj->publish('Stage', 'Live');
});
$factory->define($class, $blueprint);
}
}
}
public function setMinkParameters(array $parameters) {