3.1 compatibility

This commit is contained in:
Ingo Schommer 2013-04-01 21:37:44 +02:00
parent 0177699620
commit 8bcddb55ce
9 changed files with 32 additions and 58 deletions

View File

@ -5,9 +5,7 @@ php:
- 5.3
env:
- DB=MYSQL CORE_RELEASE=3.0
- DB=MYSQL CORE_RELEASE=3.1
- DB=MYSQL CORE_RELEASE=master
- DB=PGSQL CORE_RELEASE=master
matrix:

View File

@ -11,7 +11,7 @@ the sidebar of your website. To check out a what a [Widget](http://silverstripe.
## Requirements
* SilverStripe 3.0
* SilverStripe 3.1
## How to Use A Widget
@ -53,8 +53,8 @@ e.g.
class Page extends SiteTree {
...
static $has_one = array(
"MyWidgetArea" => "WidgetArea",
private static $has_one = array(
"MyWidgetArea" => "WidgetArea",
);
public function getCMSFields() {
@ -105,7 +105,7 @@ An example widget is below:
<?php
class FlickrWidget extends Widget {
static $db = array(
private static $db = array(
"User" => "Varchar",
"Photoset" => "Varchar",
"Tags" => "Varchar",
@ -113,14 +113,14 @@ An example widget is below:
);
static $defaults = array(
private static $defaults = array(
"NumberToShow" => 8
);
static $title = "Photos";
static $cmsTitle = "Flickr Photos";
static $description = "Shows flickr photos.";
private static $title = "Photos";
private static $cmsTitle = "Flickr Photos";
private static $description = "Shows flickr photos.";
public function Photos() {
Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js");
@ -236,7 +236,7 @@ sure that your controller follows the usual naming conventions, and it will be a
**mysite/code/MyWidget.php**
class MyWidget extends Widget {
static $db = array(
private static $db = array(
'TestValue' => 'Text'
);
}

View File

@ -8,7 +8,7 @@ class WidgetContentControllerExtension extends Extension {
*
* @var array
*/
public static $allowed_actions = array(
private static $allowed_actions = array(
'handleWidget'
);

View File

@ -16,7 +16,7 @@ class Widget extends DataObject {
*
* @var array
*/
public static $db = array(
private static $db = array(
"Sort" => "Int",
"Enabled" => "Boolean"
);
@ -25,7 +25,7 @@ class Widget extends DataObject {
*
* @var array
*/
public static $defaults = array(
private static $defaults = array(
'Enabled' => true
);
@ -33,7 +33,7 @@ class Widget extends DataObject {
*
* @var array
*/
public static $has_one = array(
private static $has_one = array(
"Parent" => "WidgetArea",
);
@ -41,43 +41,43 @@ class Widget extends DataObject {
*
* @var array
*/
public static $has_many = array();
private static $has_many = array();
/**
*
* @var array
*/
public static $many_many = array();
private static $many_many = array();
/**
*
* @var array
*/
public static $belongs_many_many = array();
private static $belongs_many_many = array();
/**
*
* @var string
*/
public static $default_sort = "\"Sort\"";
private static $default_sort = "\"Sort\"";
/**
*
* @var string
*/
public static $title = "Widget Title";
private static $title = "Widget Title";
/**
*
* @var string
*/
public static $cmsTitle = "Name of this widget";
private static $cmsTitle = "Name of this widget";
/**
*
* @var string
*/
public static $description = "Description of what this widget does.";
private static $description = "Description of what this widget does.";
/**
*
@ -245,7 +245,7 @@ class Widget_Controller extends Controller {
*
* @var array
*/
public static $allowed_actions = array(
private static $allowed_actions = array(
'editablesegment'
);

View File

@ -10,34 +10,10 @@ class WidgetArea extends DataObject {
*
* @var array
*/
public static $db = array();
/**
*
* @var array
*/
public static $has_one = array();
/**
*
* @var array
*/
public static $has_many = array(
private static $has_many = array(
"Widgets" => "Widget"
);
/**
*
* @var array
*/
public static $many_many = array();
/**
*
* @var array
*/
public static $belongs_many_many = array();
/**
*
* @var string

View File

@ -11,7 +11,7 @@
],
"require":
{
"silverstripe/framework": "3.*",
"silverstripe/cms": "3.*"
"silverstripe/framework": "~3.1",
"silverstripe/cms": "~3.1"
}
}

View File

@ -447,17 +447,17 @@ class WidgetAreaEditorTest extends SapphireTest {
}
class WidgetAreaEditorTest_FakePage extends Page implements TestOnly {
public static $has_one = array(
private static $has_one = array(
"SideBar" => "WidgetArea",
"BottomBar" => "WidgetArea",
);
}
class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
static $cmsTitle = "Test widget";
static $title = "Test widget";
static $description = "Test widget";
static $db = array(
private static $cmsTitle = "Test widget";
private static $title = "Test widget";
private static $description = "Test widget";
private static $db = array(
'Title' => 'Varchar'
);
public function getCMSFields() {

View File

@ -4,7 +4,7 @@
* @subpackage tests
*/
class WidgetControllerTest extends FunctionalTest {
static $fixture_file = 'WidgetControllerTest.yml';
protected static $fixture_file = 'WidgetControllerTest.yml';
protected $extraDataObjects = array(
'WidgetControllerTestPage',
@ -54,7 +54,7 @@ class WidgetControllerTest extends FunctionalTest {
* @subpackage tests
*/
class WidgetControllerTest_Widget extends Widget implements TestOnly {
static $db = array(
private static $db = array(
'TestValue' => 'Text'
);
}

View File

@ -4,7 +4,7 @@
* @subpackage tests
*/
class WidgetControllerTestPage extends Page implements TestOnly {
static $has_one = array(
private static $has_one = array(
'WidgetControllerTestSidebar' => 'WidgetArea'
);
}