Browse files

BUGFIX: Replace deprecated extraStatics with new methods on Versioned…

… and Hierarchy
  • Loading branch information...
1 parent 876f4c5 commit 9c2ebc3e5f610cc7107337c7756794e223353212 @hafriedlander hafriedlander committed Dec 22, 2011
Showing with 12 additions and 32 deletions.
  1. +4 −14 model/Hierarchy.php
  2. +8 −18 model/Versioned.php
View
18 model/Hierarchy.php
@@ -24,20 +24,10 @@ function augmentDatabase() {
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
26 model/Versioned.php
@@ -102,26 +102,16 @@ function __construct($stages) {
$this->defaultStage = reset($stages);
$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
*/

0 comments on commit 9c2ebc3

Please sign in to comment.