BUGFIX: Added explicit DataObjectDecorator::load_extra_statics() calls as a workaround for issues with extensions defined directly in-object.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79720 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-22 02:42:42 +00:00
parent d6f804d379
commit e0fbc7ac83
4 changed files with 45 additions and 2 deletions

View File

@ -1941,4 +1941,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
} }
} }
?>
// Workaround for issues with extensions defined directly on the class in trunk
if(method_exists('DataObjectDecorator', 'load_extra_statics')) {
DataObjectDecorator::load_extra_statics('SiteTree', 'Hierarchy');
DataObjectDecorator::load_extra_statics('SiteTree', 'Versioned');
}
?>

View File

@ -617,4 +617,9 @@ class File extends DataObject {
} }
// Workaround for issues with extensions defined directly on the class in trunk
if(method_exists('DataObjectDecorator', 'load_extra_statics')) {
DataObjectDecorator::load_extra_statics('File', 'Hierarchy');
}
?> ?>

View File

@ -388,4 +388,9 @@ class Group extends DataObject {
} }
} }
// Workaround for issues with extensions defined directly on the class in trunk
if(method_exists('DataObjectDecorator', 'load_extra_statics')) {
DataObjectDecorator::load_extra_statics('Group', 'Hierarchy');
}
?> ?>

View File

@ -39,5 +39,31 @@ class VersionedTest extends SapphireTest {
$this->assertEquals(array("Page 1", "Page 2", "Page 3"), $allPages->column('Title')); $this->assertEquals(array("Page 1", "Page 2", "Page 3"), $allPages->column('Title'));
} }
function testVersionedFieldsAdded() {
$obj = new VersionedTest_DataObject();
// Check that the Version column is added as a full-fledged column
$this->assertType('Int', $obj->dbObject('Version'));
} $obj2 = new VersionedTest_Subclass();
// Check that the Version column is added as a full-fledged column
$this->assertType('Int', $obj2->dbObject('Version'));
}
}
class VersionedTest_DataObject extends DataObject {
static $db = array(
"Name" => "Varchar",
);
static $extensions = array(
"Versioned('Stage', 'Live')"
);
}
class VersionedTest_Subclass extends VersionedTest_DataObject {
static $db = array(
"ExtraField" => "Varchar",
);
}