mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE #4929: Add $class argument to DataObjectDecorator::extraStatics() (from r97582)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102508 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
37cbb9a92a
commit
1417722d9e
@ -59,7 +59,7 @@ abstract class DataObjectDecorator extends Extension {
|
|||||||
// If the extension has been manually applied to a subclass, we should ignore that.
|
// If the extension has been manually applied to a subclass, we should ignore that.
|
||||||
if(Object::has_extension(get_parent_class($class), $extension)) return;
|
if(Object::has_extension(get_parent_class($class), $extension)) return;
|
||||||
|
|
||||||
$statics = call_user_func(array($extension, $extraStaticsMethod));
|
$statics = call_user_func(array($extension, $extraStaticsMethod), $class);
|
||||||
|
|
||||||
if($statics) {
|
if($statics) {
|
||||||
foreach($statics as $name => $newVal) {
|
foreach($statics as $name => $newVal) {
|
||||||
|
@ -162,7 +162,10 @@ class DataObjectDecoratorTest_Player extends DataObject implements TestOnly {
|
|||||||
|
|
||||||
class DataObjectDecoratorTest_PlayerDecorator extends DataObjectDecorator implements TestOnly {
|
class DataObjectDecoratorTest_PlayerDecorator extends DataObjectDecorator implements TestOnly {
|
||||||
|
|
||||||
function extraStatics() {
|
function extraStatics($class) {
|
||||||
|
// Only add these extensions if the $class is set to DataObjectDecoratorTest_Player, to
|
||||||
|
// test that the argument works.
|
||||||
|
if($class == 'DataObjectDecoratorTest_Player') {
|
||||||
return array(
|
return array(
|
||||||
'db' => array(
|
'db' => array(
|
||||||
'Address' => 'Text',
|
'Address' => 'Text',
|
||||||
@ -174,6 +177,7 @@ class DataObjectDecoratorTest_PlayerDecorator extends DataObjectDecorator implem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user