Skip to content

Commit

Permalink
BUGFIX: Fixed bugs in previous change to DOD
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@77849 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
Sam Minnee committed Feb 2, 2011
1 parent 3cbf9ae commit 9ff7f26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/model/DataObjectDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class DataObjectDecorator extends Extension {
* Set the owner of this decorator.
* @param DataObject $owner
*/
function setOwner(Object $owner) {
function setOwner(Object $owner, $ownerBaseClass = null) {
if(!($owner instanceof DataObject)) {
user_error(sprintf(
"DataObjectDecorator->setOwner(): Trying to decorate an object of class '%s' with '%s',
Expand All @@ -44,7 +44,7 @@ function setOwner(Object $owner) {
return false;
}

parent::setOwner($owner);
parent::setOwner($owner, $ownerBaseClass);
}

/**
Expand All @@ -54,6 +54,9 @@ function loadExtraStatics() {
if(!empty(self::$extra_statics_loaded[$this->ownerBaseClass][$this->class])) return;
self::$extra_statics_loaded[$this->ownerBaseClass][$this->class] = true;

// If the extension has been manually applied to a subclass, we should ignore that.
if(Object::has_extension(get_parent_class($this->owner), $this->class)) return;

if($fields = $this->extraStatics()) {
foreach($fields as $relation => $fields) {
if(in_array($relation, self::$decoratable_statics)) {
Expand Down

0 comments on commit 9ff7f26

Please sign in to comment.