MINOR: Updated places that expect a DataObjectSet to accept an SS_List instance.

This commit is contained in:
ajshort 2011-05-02 17:14:05 +10:00
parent a940fb2888
commit 04e5dae22e
9 changed files with 12 additions and 12 deletions

View File

@ -26,7 +26,7 @@ abstract class CMSBatchAction extends Object {
* Run this action for the given set of pages. * Run this action for the given set of pages.
* Return a set of status-updated JavaScript to return to the CMS. * 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. * 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()); $status = array('modified' => array(), 'error' => array());
foreach($objs as $obj) { foreach($objs as $obj) {

View File

@ -358,7 +358,7 @@ class SecurityAdmin_DeleteBatchAction extends CMSBatchAction {
return _t('AssetAdmin_DeleteBatchAction.TITLE', 'Delete groups'); return _t('AssetAdmin_DeleteBatchAction.TITLE', 'Delete groups');
} }
function run(DataObjectSet $records) { function run(SS_List $records) {
$status = array( $status = array(
'modified'=>array(), 'modified'=>array(),
'deleted'=>array() 'deleted'=>array()

View File

@ -288,7 +288,7 @@ abstract class DataFormatter extends Object {
/** /**
* Convert a data object set to this format. Return a string. * 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 * @param string $strData HTTP Payload as string

View File

@ -121,7 +121,7 @@ class JSONDataFormatter extends DataFormatter {
* @param DataObjectSet $set * @param DataObjectSet $set
* @return String XML * @return String XML
*/ */
public function convertDataObjectSet(DataObjectSet $set, $fields = null) { public function convertDataObjectSet(SS_List $set, $fields = null) {
$items = array(); $items = array();
foreach ($set as $do) $items[] = $this->convertDataObjectToJSONObject($do, $fields); foreach ($set as $do) $items[] = $this->convertDataObjectToJSONObject($do, $fields);

View File

@ -99,7 +99,7 @@ class RSSFeed extends ViewableData {
* @param string $etag The ETag is an unique identifier that is changed * @param string $etag The ETag is an unique identifier that is changed
* every time the representation does * every time the representation does
*/ */
function __construct(DataObjectSet $entries, $link, $title, function __construct(SS_List $entries, $link, $title,
$description = null, $titleField = "Title", $description = null, $titleField = "Title",
$descriptionField = "Content", $authorField = null, $descriptionField = "Content", $authorField = null,
$lastModified = null, $etag = null) { $lastModified = null, $etag = null) {

View File

@ -132,7 +132,7 @@ class XMLDataFormatter extends DataFormatter {
* @param DataObjectSet $set * @param DataObjectSet $set
* @return String XML * @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"); Controller::curr()->getResponse()->addHeader("Content-Type", "text/xml");
$className = $set->class; $className = $set->class;

View File

@ -17,12 +17,12 @@ class PaginatedList extends SS_ListDecorator {
/** /**
* Constructs a new paginated list instance around a list. * 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. * be used to get the subset of objects to show.
* @param array|ArrayAccess Either a map of request parameters or * @param array|ArrayAccess Either a map of request parameters or
* request object that the pagination offset is read from. * 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) { if (!is_array($request) && !$request instanceof ArrayAccess) {
throw new Exception('The request must be readable as an array.'); throw new Exception('The request must be readable as an array.');
} }

View File

@ -392,7 +392,7 @@ JS
$this->customCsvQuery = $query; $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); 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 // The type-hinting above doesn't seem to work consistently

View File

@ -42,9 +42,9 @@ class PermissionCheckboxSetField extends FormField {
$this->filterField = $filterField; $this->filterField = $filterField;
$this->managedClass = $managedClass; $this->managedClass = $managedClass;
if(is_a($records, 'DataObjectSet')) { if($records instanceof SS_List) {
$this->records = $records; $this->records = $records;
} elseif(is_a($records, 'DataObject')) { } elseif($records instanceof Group) {
$this->records = new DataObjectSet($records); $this->records = new DataObjectSet($records);
} elseif($records) { } elseif($records) {
throw new InvalidArgumentException('$record should be either a Group record, or a DataObjectSet of Group records'); throw new InvalidArgumentException('$record should be either a Group record, or a DataObjectSet of Group records');