mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
d6f804d379
commit
e0fbc7ac83
@ -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');
|
||||
}
|
||||
|
||||
?>
|
@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -40,4 +40,30 @@ class VersionedTest extends SapphireTest {
|
||||
|
||||
}
|
||||
|
||||
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",
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user