Permalink
Browse files

MINOR Don't use deprecated extraStatics when adding extra statics with

DataExtension
  • Loading branch information...
1 parent ec3ebc9 commit 542d727db2d2a6577dbae1248bcdf9f78d80ba37 @halkyon halkyon committed May 23, 2012
Showing with 18 additions and 27 deletions.
  1. +5 −9 code/model/SiteTreeFileExtension.php
  2. +5 −8 tests/model/SiteTreeBacklinksTest.php
  3. +8 −10 tests/model/VirtualPageTest.php
@@ -4,15 +4,11 @@
* @subpackage model
*/
class SiteTreeFileExtension extends DataExtension {
-
- function extraStatics($class = null, $extension = null) {
- return array(
- 'belongs_many_many' => array(
- "BackLinkTracking" => "SiteTree",
- )
- );
- }
-
+
+ public static $belongs_many_many = array(
+ 'BackLinkTracking' => 'SiteTree'
+ );
+
/**
* Extend through {@link updateBackLinkTracking()} in your own {@link Extension}.
*
@@ -243,14 +243,11 @@ function testLinkTrackingOnExtraContentFields() {
}
class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly {
- function extraStatics($class = null, $extension = null) {
- return array(
- 'db' => array(
- 'ExtraContent' => 'HTMLText',
- ),
- );
- }
-
+
+ static $db = array(
+ 'ExtraContent' => 'HTMLText',
+ );
+
function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent"));
}
@@ -607,14 +607,12 @@ class VirtualPageTest_VirtualPageSub extends VirtualPage implements TestOnly {
}
class VirtualPageTest_PageExtension extends DataExtension implements TestOnly {
- function extraStatics($class = null, $extension = null) {
- return array(
- 'db' => array(
- // These fields are just on an extension to simulate shared properties between Page and VirtualPage.
- // Not possible through direct $db definitions due to VirtualPage inheriting from Page, and Page being defined elsewhere.
- 'MySharedVirtualField' => 'Text',
- 'MySharedNonVirtualField' => 'Text',
- )
- );
- }
+
+ static $db = array(
+ // These fields are just on an extension to simulate shared properties between Page and VirtualPage.
+ // Not possible through direct $db definitions due to VirtualPage inheriting from Page, and Page being defined elsewhere.
+ 'MySharedVirtualField' => 'Text',
+ 'MySharedNonVirtualField' => 'Text',
+ );
+
}

0 comments on commit 542d727

Please sign in to comment.