mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02: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(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) {
|
||||
foreach($statics as $name => $newVal) {
|
||||
|
@ -162,17 +162,21 @@ class DataObjectDecoratorTest_Player extends DataObject implements TestOnly {
|
||||
|
||||
class DataObjectDecoratorTest_PlayerDecorator extends DataObjectDecorator implements TestOnly {
|
||||
|
||||
function extraStatics() {
|
||||
return array(
|
||||
'db' => array(
|
||||
'Address' => 'Text',
|
||||
'DateBirth' => 'Date',
|
||||
'Status' => "Enum('Shooter,Goalie')"
|
||||
),
|
||||
'defaults' => array(
|
||||
'Status' => 'Goalie'
|
||||
)
|
||||
);
|
||||
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(
|
||||
'db' => array(
|
||||
'Address' => 'Text',
|
||||
'DateBirth' => 'Date',
|
||||
'Status' => "Enum('Shooter,Goalie')"
|
||||
),
|
||||
'defaults' => array(
|
||||
'Status' => 'Goalie'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user