From f2f6b6e18c143bc720c590f85572d39b026d3d44 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 30 Apr 2015 22:49:17 +1200 Subject: [PATCH] 3.2.x compat --- README.md | 4 ++-- code/controller/WidgetContentControllerExtension.php | 8 ++++---- code/model/WidgetArea.php | 3 ++- composer.json | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index df80931..dd24bca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Widgets Module -[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-widgets.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-widgets) +[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-widgets.png?branch=1.1)](http://travis-ci.org/silverstripe/silverstripe-widgets) ## Introduction @@ -11,7 +11,7 @@ the sidebar of your website. To check out a what a [Widget](http://silverstripe. ## Requirements - * SilverStripe 3.1 + * SilverStripe 3.2 ### Installation diff --git a/code/controller/WidgetContentControllerExtension.php b/code/controller/WidgetContentControllerExtension.php index ceb6281..f5f543c 100644 --- a/code/controller/WidgetContentControllerExtension.php +++ b/code/controller/WidgetContentControllerExtension.php @@ -31,7 +31,7 @@ class WidgetContentControllerExtension extends Extension { // find WidgetArea relations $widgetAreaRelations = array(); - $hasOnes = $this->owner->data()->has_one(); + $hasOnes = $this->owner->data()->hasOne(); if(!$hasOnes) { return false; @@ -51,9 +51,9 @@ class WidgetContentControllerExtension extends Extension { break; } - $widget = $this->owner->data()->$widgetAreaRelation()->Widgets( - sprintf('"Widget"."ID" = %d', $SQL_id) - )->First(); + $widget = $this->owner->data()->$widgetAreaRelation()->Widgets() + ->filter('ID', $SQL_id) + ->First(); } if(!$widget) { diff --git a/code/model/WidgetArea.php b/code/model/WidgetArea.php index af3fa1d..bf72aae 100644 --- a/code/model/WidgetArea.php +++ b/code/model/WidgetArea.php @@ -51,7 +51,8 @@ class WidgetArea extends DataObject { * @return HasManyList */ public function ItemsToRender() { - return $this->getComponents('Widgets', "\"Widget\".\"Enabled\" = 1"); + return $this->getComponents('Widgets') + ->filter("Enabled", 1); } /** diff --git a/composer.json b/composer.json index ee4a63b..9985bfa 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ } ], "require": { - "silverstripe/framework": ">=3.1", - "silverstripe/cms": ">=3.1" + "silverstripe/framework": "~3.2", + "silverstripe/cms": "~3.2" }, "require-dev": { "phpunit/PHPUnit": "~3.7@stable"