MINOR If the instance class property can't be found in DataObject::defineMethods(), throw an error because parent::__construct() hasn't been called which will break DataObjectDecorator

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@83580 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-08-03 06:19:00 +00:00 committed by Sam Minnee
parent 99038acbf1
commit 008acc99a0

View File

@ -302,6 +302,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// those objects, which is a better mechanism. Perhaps extensions defined inside the
// class def can somehow be applied at definiton time also?
if($this->extension_instances) foreach($this->extension_instances as $i => $instance) {
if(!$instance->class) {
$class = get_class($instance);
user_error("DataObject::defineMethods(): Please ensure {$class}::__construct() calls parent::__construct()", E_USER_ERROR);
}
DataObjectDecorator::load_extra_statics($this->class, $instance->class);
}