I'm running SilverStripe 2.4 from the 2.4 svn branch (r106221)
My SiteConfig started behaving strangely after a recent svn update. I am recieveing an error when attempting to save my SiteConfig. The issue seems to be that fields from the Page getCMSFields method are being 'saveInto'-ed the SiteConfig object causing this error:
ERROR [User Error]: Uncaught Exception: DataObject->getComponent(): Could not find component 'WidgetArea'.
IN POST /admin/EditForm
Line 1225 in /xxxx/xxxx/public_html/sapphire/core/model/DataObject.php
Source
======
1216: if($joinID) {
1217: $component = DataObject::get_one($class, "\"$joinField\" = $joinID");
1218: }
1219:
1220: if(!isset($component) || !$component) {
1221: $component = new $class();
1222: $component->$joinField = $this->ID;
1223: }
1224: } else {
* 1225: throw new Exception("DataObject->getComponent(): Could not find component '$componentName'.");
1226: }
1227:
1228: $this->components[$componentName] = $component;
1229: return $component;
1230: }
1231:
Trace
=====
<ul>DataObject->getComponent(WidgetArea)
line 66 of WidgetAreaEditor.php
WidgetAreaEditor->saveInto(SiteConfig)
line 998 of Form.php
Form->saveInto(SiteConfig)
line 379 of CMSMain.php
CMSMain->save_siteconfig(Array,Form,SS_HTTPRequest)
line 300 of Form.php
Form->httpSubmission(SS_HTTPRequest)
line 137 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
line 155 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
line 127 of Director.php
Director::direct(/admin/EditForm)
line 127 of main.php
</ul>
My Page.php looks like this:
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
'WidgetArea' => 'WidgetArea'
);
function getCMSFields() {
$fields = parent::getCMSFields();
//remove for clutter reasons clutter
$fields->removeFieldFromTab('Root.Content','GoogleSitemap');
$fields->addFieldToTab('Root.Content.Widgets', new WidgetAreaEditor('WidgetArea'));
return $fields;
}
}
This seems to have started since the latest svn update. I will roll back and report back, but it would be interesting to see if anyone else has this problem.