From 04e5dae22ee4b960d237dc49b4c2da9d42fd07f2 Mon Sep 17 00:00:00 2001 From: ajshort Date: Mon, 2 May 2011 17:14:05 +1000 Subject: [PATCH] MINOR: Updated places that expect a DataObjectSet to accept an SS_List instance. --- admin/code/CMSBatchAction.php | 4 ++-- admin/code/SecurityAdmin.php | 2 +- api/DataFormatter.php | 2 +- api/JSONDataFormatter.php | 2 +- api/RSSFeed.php | 2 +- api/XMLDataFormatter.php | 2 +- core/PaginatedList.php | 4 ++-- forms/TableListField.php | 2 +- security/PermissionCheckboxSetField.php | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/admin/code/CMSBatchAction.php b/admin/code/CMSBatchAction.php index fcd4d6437..436002108 100644 --- a/admin/code/CMSBatchAction.php +++ b/admin/code/CMSBatchAction.php @@ -26,7 +26,7 @@ abstract class CMSBatchAction extends Object { * Run this action for the given set of pages. * Return a set of status-updated JavaScript to return to the CMS. */ - abstract function run(DataObjectSet $objs); + abstract function run(SS_List $objs); /** * Helper method for processing batch actions. @@ -46,7 +46,7 @@ abstract class CMSBatchAction extends Object { * } * } */ - public function batchaction(DataObjectSet $objs, $helperMethod, $successMessage, $arguments = array()) { + public function batchaction(SS_List $objs, $helperMethod, $successMessage, $arguments = array()) { $status = array('modified' => array(), 'error' => array()); foreach($objs as $obj) { diff --git a/admin/code/SecurityAdmin.php b/admin/code/SecurityAdmin.php index f13e3b556..0e68649ab 100644 --- a/admin/code/SecurityAdmin.php +++ b/admin/code/SecurityAdmin.php @@ -358,7 +358,7 @@ class SecurityAdmin_DeleteBatchAction extends CMSBatchAction { return _t('AssetAdmin_DeleteBatchAction.TITLE', 'Delete groups'); } - function run(DataObjectSet $records) { + function run(SS_List $records) { $status = array( 'modified'=>array(), 'deleted'=>array() diff --git a/api/DataFormatter.php b/api/DataFormatter.php index 9e87196da..a988fb4a9 100644 --- a/api/DataFormatter.php +++ b/api/DataFormatter.php @@ -288,7 +288,7 @@ abstract class DataFormatter extends Object { /** * Convert a data object set to this format. Return a string. */ - abstract function convertDataObjectSet(DataObjectSet $set); + abstract function convertDataObjectSet(SS_List $set); /** * @param string $strData HTTP Payload as string diff --git a/api/JSONDataFormatter.php b/api/JSONDataFormatter.php index eeebc1bc3..5557a74f2 100644 --- a/api/JSONDataFormatter.php +++ b/api/JSONDataFormatter.php @@ -121,7 +121,7 @@ class JSONDataFormatter extends DataFormatter { * @param DataObjectSet $set * @return String XML */ - public function convertDataObjectSet(DataObjectSet $set, $fields = null) { + public function convertDataObjectSet(SS_List $set, $fields = null) { $items = array(); foreach ($set as $do) $items[] = $this->convertDataObjectToJSONObject($do, $fields); diff --git a/api/RSSFeed.php b/api/RSSFeed.php index d146c6ae9..0cb34c236 100755 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -99,7 +99,7 @@ class RSSFeed extends ViewableData { * @param string $etag The ETag is an unique identifier that is changed * every time the representation does */ - function __construct(DataObjectSet $entries, $link, $title, + function __construct(SS_List $entries, $link, $title, $description = null, $titleField = "Title", $descriptionField = "Content", $authorField = null, $lastModified = null, $etag = null) { diff --git a/api/XMLDataFormatter.php b/api/XMLDataFormatter.php index 63d882211..dd49e930a 100644 --- a/api/XMLDataFormatter.php +++ b/api/XMLDataFormatter.php @@ -132,7 +132,7 @@ class XMLDataFormatter extends DataFormatter { * @param DataObjectSet $set * @return String XML */ - public function convertDataObjectSet(DataObjectSet $set, $fields = null) { + public function convertDataObjectSet(SS_List $set, $fields = null) { Controller::curr()->getResponse()->addHeader("Content-Type", "text/xml"); $className = $set->class; diff --git a/core/PaginatedList.php b/core/PaginatedList.php index 2e123b5c7..95112d90c 100644 --- a/core/PaginatedList.php +++ b/core/PaginatedList.php @@ -17,12 +17,12 @@ class PaginatedList extends SS_ListDecorator { /** * Constructs a new paginated list instance around a list. * - * @param DataObjectSet $list The list to paginate. The getRange method will + * @param SS_List $list The list to paginate. The getRange method will * be used to get the subset of objects to show. * @param array|ArrayAccess Either a map of request parameters or * request object that the pagination offset is read from. */ - public function __construct(DataObjectSet $list, $request = array()) { + public function __construct(SS_List $list, $request = array()) { if (!is_array($request) && !$request instanceof ArrayAccess) { throw new Exception('The request must be readable as an array.'); } diff --git a/forms/TableListField.php b/forms/TableListField.php index 27ab91d62..0e93cd4a5 100644 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -392,7 +392,7 @@ JS $this->customCsvQuery = $query; } - function setCustomSourceItems(DataObjectSet $items) { + function setCustomSourceItems(SS_List $items) { user_error('TableList::setCustomSourceItems() deprecated, just pass the items into the constructor', E_USER_WARNING); // The type-hinting above doesn't seem to work consistently diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index cac263e03..14467d1d8 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -42,9 +42,9 @@ class PermissionCheckboxSetField extends FormField { $this->filterField = $filterField; $this->managedClass = $managedClass; - if(is_a($records, 'DataObjectSet')) { + if($records instanceof SS_List) { $this->records = $records; - } elseif(is_a($records, 'DataObject')) { + } elseif($records instanceof Group) { $this->records = new DataObjectSet($records); } elseif($records) { throw new InvalidArgumentException('$record should be either a Group record, or a DataObjectSet of Group records');