Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX: Replace deprecated extraStatics with new methods on Versioned…

… and Hierarchy
  • Loading branch information...
commit 9c2ebc3e5f610cc7107337c7756794e223353212 1 parent 876f4c5
@hafriedlander hafriedlander authored
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
*/
Please sign in to comment.
Something went wrong with that request. Please try again.