BUGFIX: Replace deprecated extraStatics with new methods on Versioned and Hierarchy

This commit is contained in:
Hamish Friedlander 2011-12-22 15:30:46 +13:00
parent 876f4c5299
commit 9c2ebc3e5f
2 changed files with 12 additions and 32 deletions

View File

@ -24,20 +24,10 @@ class Hierarchy extends DataExtension {
function augmentWrite(&$manipulation) { function augmentWrite(&$manipulation) {
} }
/** static function add_to_class($class, $extensionClass) {
* Config::inst()->update($class, 'has_one', array('Parent' => $class));
* @param string $class parent::add_to_class($class, $extensionClass);
* @param string $extension
* @return array
*/
function extraStatics($class=null, $extension=null) {
return array(
'has_one' => array(
// TODO this method is called *both* statically and on an instance
"Parent" => ($class) ? $class : $this->owner->class
)
);
} }
/** /**

View File

@ -102,26 +102,16 @@ class Versioned extends DataExtension {
$this->defaultStage = reset($stages); $this->defaultStage = reset($stages);
$this->liveStage = array_pop($stages); $this->liveStage = array_pop($stages);
} }
/** static $db = array(
* 'Version' => 'Int'
* @param string $class );
* @param string $extension
* @return array static function add_to_class($class, $extensionClass) {
*/ Config::inst()->update($class, 'has_many', array('Versions' => $class));
function extraStatics($class=null, $extension=null) { parent::add_to_class($class, $extensionClass);
return array(
'db' => array(
'Version' => 'Int',
),
'has_many' => array(
// TODO this method is called *both* statically and on an instance
'Versions' => ($class) ? $class : $this->owner->class,
)
);
} }
/** /**
* Amend freshly created DataQuery objects with versioned-specific information * Amend freshly created DataQuery objects with versioned-specific information
*/ */