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

@ -25,19 +25,9 @@ class Hierarchy extends DataExtension {
function augmentWrite(&$manipulation) {
}
/**
*
* @param string $class
* @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
)
);
static function add_to_class($class, $extensionClass) {
Config::inst()->update($class, 'has_one', array('Parent' => $class));
parent::add_to_class($class, $extensionClass);
}
/**

View File

@ -103,24 +103,14 @@ class Versioned extends DataExtension {
$this->liveStage = array_pop($stages);
}
/**
*
* @param string $class
* @param string $extension
* @return array
*/
function extraStatics($class=null, $extension=null) {
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,
)
static $db = array(
'Version' => 'Int'
);
}
static function add_to_class($class, $extensionClass) {
Config::inst()->update($class, 'has_many', array('Versions' => $class));
parent::add_to_class($class, $extensionClass);
}
/**
* Amend freshly created DataQuery objects with versioned-specific information