From e5ea2ea94d9c6b7dc5150e4c86a7608d1490f4e7 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 28 Oct 2011 10:45:12 +1300 Subject: [PATCH 1/4] ENHANCEMENT: Add Deprecation class to handle throwing deprecation notices nicely on methods that are still in use in framework or cms --- _config.php | 2 + dev/Deprecation.php | 161 ++++++++++++++++++++++++++++++++++ tests/dev/DeprecationTest.php | 71 +++++++++++++++ 3 files changed, 234 insertions(+) create mode 100644 dev/Deprecation.php create mode 100644 tests/dev/DeprecationTest.php diff --git a/_config.php b/_config.php index 4032b93c4..8ce65c2e6 100644 --- a/_config.php +++ b/_config.php @@ -77,5 +77,7 @@ if (!is_dir($aggregatecachedir)) mkdir($aggregatecachedir); SS_Cache::add_backend('aggregatestore', 'File', array('cache_dir' => $aggregatecachedir)); SS_Cache::pick_backend('aggregatestore', 'aggregate', 1000); +Deprecation::notification_version('3.0.0-dev'); + // TODO Remove once new ManifestBuilder with submodule support is in place require_once('admin/_config.php'); \ No newline at end of file diff --git a/dev/Deprecation.php b/dev/Deprecation.php new file mode 100644 index 000000000..623b21a91 --- /dev/null +++ b/dev/Deprecation.php @@ -0,0 +1,161 @@ +getModules() as $name => $path) { + if (strpos($callingfile, $path) === 0) { + return $name; + } + } + } + + /** + * Given a backtrace, get the method name from the immediate parent caller (the caller of #notice) + * + * @static + * @param $backtrace array - a backtrace as returned from debug_backtrace + * @return string - the name of the method + */ + protected static function get_called_method_from_trace($backtrace) { + $called = $backtrace[1]; + + if (isset($called['class'])) { + return $called['class'] . $called['type'] . $called['function']; + } + else { + return $called['function']; + } + } + + /** + * Raise a notice indicating the method is deprecated if the version passed as the second argument is greater + * than or equal to the check version set via ::notification_version + * + * @static + * @param $string - The notice to raise + * @param $atVersion - The version at which this notice should start being raised + * @return void + */ + public static function notice($atVersion, $string = '') { + if(!Director::isDev()) return; + + $checkVersion = self::$version; + // Getting a backtrace is slow, so we only do it if we need it + $backtrace = null; + + if(self::$module_version_overrides) { + $module = self::get_calling_module_from_trace($backtrace = debug_backtrace(0)); + if(isset(self::$module_version_overrides[$module])) $checkVersion = self::$module_version_overrides[$module]; + } + + // Check the version against the notice version + if ($checkVersion && version_compare($checkVersion, $atVersion, '>=')) { + // Get the calling method + if (!$backtrace) $backtrace = debug_backtrace(0); + $caller = self::get_called_method_from_trace($backtrace); + + // Get the level to raise the notice as + $level = self::$notice_level; + if (!$level) $level = defined(E_USER_DEPRECATED) ? E_USER_DEPRECATED : E_USER_NOTICE; + + // Then raise the notice + user_error($caller.' is deprecated.'.($string ? ' '.$string : ''), $level); + } + } + + /** + * Method for when testing. Dump all the current version settings to a variable for later passing to restore + * @return array - opaque array that should only be used to pass to ::restore_version_settings + */ + public static function dump_settings() { + return array( + 'level' => self::$notice_level, + 'version' => self::$version, + 'moduleVersions' => self::$module_version_overrides + ); + } + + /** + * Method for when testing. Restore all the current version settings from a variable + * @static + * @param $settings array - An array as returned by ::dump_version_settings + * @return void + */ + public static function restore_settings($settings) { + self::$notice_level = $settings['level']; + self::$version = $settings['version']; + self::$module_version_overrides = $settings['moduleVersions']; + } + +} \ No newline at end of file diff --git a/tests/dev/DeprecationTest.php b/tests/dev/DeprecationTest.php new file mode 100644 index 000000000..b36b05aa2 --- /dev/null +++ b/tests/dev/DeprecationTest.php @@ -0,0 +1,71 @@ +callThatOriginatesFromSapphire(); + } + + /** + * @expectedException PHPUnit_Framework_Error_Notice + */ + function testMatchingModuleNotifcationVersionAffectsNotice() { + Deprecation::notification_version('1.0.0'); + Deprecation::notification_version('3.0.0', 'sapphire'); + $this->callThatOriginatesFromSapphire(); + } + + protected function callThatOriginatesFromSapphire() { + $this->assertEquals(DeprecationTest_Deprecation::get_module(), 'sapphire'); + Deprecation::notice('2.0.0', 'Deprecation test passed'); + } + + function testMethodNameCalculation() { + $this->assertEquals(DeprecationTest_Deprecation::get_method(), 'DeprecationTest->testMethodNameCalculation'); + } + +} From 4c0105a3c4e7f7aa556dd0d02abc641b61fb8f3b Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 28 Oct 2011 14:36:20 +1300 Subject: [PATCH 2/4] MINOR: Fix deprecated notices - change old references to 2.5 from ORM work to 3.0.0, and use new deprecation notice system --- forms/FieldSet.php | 8 ++++---- model/DataObject.php | 41 +++++++++++++++++++++-------------------- model/DataObjectSet.php | 8 ++++---- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/forms/FieldSet.php b/forms/FieldSet.php index 34c13111e..195b7ab00 100644 --- a/forms/FieldSet.php +++ b/forms/FieldSet.php @@ -7,11 +7,11 @@ */ class FieldSet extends FieldList { + /** + * @deprecated 3.0.0 Use FieldList instead + */ public function __construct($items = array()) { - // user_error( - // 'FieldSet is deprecated, please use FieldList instead.', E_USER_NOTICE - // ); - + Deprecation::notice('3.0.0', 'Use FieldList instead'); parent::__construct(!is_array($items) || func_num_args() > 1 ? func_get_args(): $items); } } diff --git a/model/DataObject.php b/model/DataObject.php index d154abe74..943942a71 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -2457,10 +2457,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated 2.5 Use DataObject::get() instead, with the new data mapper there's no reason not to. + * @deprecated 3.0.0 Use DataObject::get and DataList to do your querying */ public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having = "") { - user_error("DataObject::buildSQL() deprecated; just use DataObject::get() with the new data mapper", E_USER_NOTICE); + Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying'); return $this->extendedSQL($filter, $sort, $limit, $join, $having); } @@ -2471,7 +2471,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity private static $cache_buildSQL_query; /** - * @deprecated 2.5 Use DataObject::get() instead, with the new data mapper there's no reason not to. + * @deprecated 3.0.0 Use DataObject::get and DataList to do your querying */ public function extendedSQL($filter = "", $sort = "", $limit = "", $join = ""){ $dataList = DataObject::get($this->class, $filter, $sort, $join, $limit); @@ -2492,7 +2492,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return mixed The objects matching the filter, in the class specified by $containerClass */ public static function get($callerClass, $filter = "", $sort = "", $join = "", $limit = "", $containerClass = "DataList") { - // Deprecated 2.5? + // Todo: Determine if we can deprecate for 3.0.0 and use DI or something instead // Todo: Make the $containerClass method redundant if($containerClass != "DataList") user_error("The DataObject::get() \$containerClass argument has been deprecated", E_USER_NOTICE); $result = DataList::create($callerClass)->where($filter)->sort($sort)->join($join)->limit($limit); @@ -2501,9 +2501,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated + * @deprecated 3.0.0 Use DataObject::get and DataList to do your querying */ public function Aggregate($class = null) { + Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying'); + if($class) { $list = new DataList($class); $list->setModel(DataModel::inst()); @@ -2516,9 +2518,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated + * @deprecated 3.0.0 Use DataObject::get and DataList to do your querying */ public function RelationshipAggregate($relationship) { + Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying'); + return $this->$relationship(); } @@ -2526,7 +2530,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * The internal function that actually performs the querying for get(). * DataObject::get("Table","filter") is the same as singleton("Table")->instance_get("filter") * - * @deprecated 2.5 Use DataObject::get() + * @deprecated 3.0.0 Use DataObject::get and DataList to do your querying * * @param string $filter A filter to be inserted into the WHERE clause. * @param string $sort A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort will be used. @@ -2537,15 +2541,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return mixed The objects matching the filter, in the class specified by $containerClass */ public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet") { - user_error("instance_get deprecated", E_USER_NOTICE); + Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying'); return self::get($this->class, $filter, $sort, $join, $limit, $containerClass); - } /** * Take a database {@link SS_Query} and instanciate an object for each record. * - * @deprecated 2.5 Use DataObject::get(), you don't need to side-step it any more + * @deprecated 3.0.0 Replaced by DataList * * @param SS_Query|array $records The database records, a {@link SS_Query} object or an array of maps. * @param string $containerClass The class to place all of the objects into. @@ -2553,8 +2556,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return mixed The new objects in an object of type $containerClass */ function buildDataObjectSet($records, $containerClass = "DataObjectSet", $query = null, $baseClass = null) { - user_error('buildDataObjectSet is deprecated; use DataList to do your querying', E_USER_NOTICE); - + Deprecation::notice('3.0.0', 'Replaced by DataList'); + foreach($records as $record) { if(empty($record['RecordClassName'])) { $record['RecordClassName'] = $record['ClassName']; @@ -2670,7 +2673,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity /** * Does the hard work for get_one() * - * @deprecated 2.5 Use DataObject::get_one() instead + * @deprecated 3.0.0 Use DataObject::get_one() instead * * @uses DataExtension->augmentSQL() * @@ -2679,7 +2682,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return DataObject The first item matching the query */ public function instance_get_one($filter, $orderby = null) { - user_error("DataObjct::instance_get_one is deprecated", E_USER_NOTICE); + Deprecation::notice('3.0.0', 'Use DataObject::get_one() instead'); return DataObject::get_one($this->class, $filter, true, $orderby); } @@ -2822,22 +2825,20 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } /** - * @deprecated 2.5 use self::database_fields() + * @deprecated 3.0.0 Use DataObject::database_fields() instead * @see DataObject::database_fields() */ public function databaseFields() { - user_error("databaseFields() is deprecated; use self::database_fields() " - . "instead", E_USER_NOTICE); + Deprecation::notice('3.0.0', 'Use DataObject::database_fields() instead'); return self::database_fields($this->class); } /** - * @deprecated 2.5 use self::custom_database_fields() + * @deprecated 3.0.0 Use DataObject::custom_database_fields() instead * @see DataObject::custom_database_fields() */ public function customDatabaseFields() { - user_error("customDatabaseFields() is deprecated; use self::custom_database_fields() " - . "instead", E_USER_NOTICE); + Deprecation::notice('3.0.0', 'Use DataObject::custom_database_fields() instead'); return self::custom_database_fields($this->class); } diff --git a/model/DataObjectSet.php b/model/DataObjectSet.php index 69f346738..852a1b2ff 100644 --- a/model/DataObjectSet.php +++ b/model/DataObjectSet.php @@ -6,11 +6,11 @@ */ class DataObjectSet extends ArrayList { + /** + * @deprecated 3.0.0 + */ public function __construct($items = array()) { - // user_error( - // 'DataObjectSet is deprecated, please use DataList or ArrayList instead.', - // E_USER_NOTICE - // ); + Deprecation::notice('3.0.0', 'Use DataList or ArrayList instead'); if ($items) { if (!is_array($items) || func_num_args() > 1) { From 0a3e0f15de55835ad0340faa4eb3733cc650b3c1 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 28 Oct 2011 14:37:27 +1300 Subject: [PATCH 3/4] MINOR: Replace references to FieldSet (now deprecated) with references to FieldList --- admin/code/CMSBatchAction.php | 2 +- admin/code/LeftAndMain.php | 2 +- admin/code/SecurityAdmin.php | 2 +- dev/BulkLoader.php | 2 +- docs/en/howto/csv-import.md | 4 +- docs/en/reference/complextablefield.md | 10 ++--- docs/en/reference/dataextension.md | 2 +- docs/en/reference/dataobject.md | 4 +- docs/en/reference/form-field-types.md | 2 +- docs/en/reference/leftandmain.md | 4 +- docs/en/reference/member.md | 8 ++-- docs/en/reference/searchcontext.md | 4 +- docs/en/reference/siteconfig.md | 2 +- docs/en/topics/form-validation.md | 4 +- docs/en/topics/forms.md | 30 +++++++------- docs/en/topics/page-types.md | 6 +-- docs/en/topics/widgets.md | 8 ++-- docs/en/tutorials/2-extending-a-basic-site.md | 2 +- docs/en/tutorials/3-forms.md | 16 ++++---- docs/en/tutorials/4-site-search.md | 4 +- .../5-dataobject-relationship-management.md | 6 +-- filesystem/File.php | 2 +- filesystem/Folder.php | 4 +- forms/ComplexTableField.php | 6 +-- forms/FieldGroup.php | 2 +- forms/FieldList.php | 40 +++++++++---------- forms/Form.php | 20 +++++----- forms/FormField.php | 10 ++--- forms/FormScaffolder.php | 2 +- forms/OptionsetField.php | 2 +- forms/TabSet.php | 2 +- forms/TableField.php | 6 +-- model/DataExtension.php | 8 ++-- model/DataObject.php | 10 ++--- search/SearchContext.php | 8 ++-- security/ChangePasswordForm.php | 8 ++-- security/Group.php | 2 +- security/Member.php | 6 +-- security/MemberLoginForm.php | 8 ++-- 39 files changed, 135 insertions(+), 135 deletions(-) mode change 100755 => 100644 forms/FieldList.php diff --git a/admin/code/CMSBatchAction.php b/admin/code/CMSBatchAction.php index 436002108..46370b6a0 100644 --- a/admin/code/CMSBatchAction.php +++ b/admin/code/CMSBatchAction.php @@ -135,7 +135,7 @@ abstract class CMSBatchAction extends Object { } - // if your batchaction has parameters, return a fieldset here + // if your batchaction has parameters, return a FieldList here function getParameterFields() { return false; } diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index 25f1a3686..8a7cc0dea 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -786,7 +786,7 @@ class LeftAndMain extends Controller { $fields = ($fields) ? $fields : $record->getCMSFields(); if ($fields == null) { user_error( - "getCMSFields() returned null - it should return a FieldSet object. + "getCMSFields() returned null - it should return a FieldList object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR ); diff --git a/admin/code/SecurityAdmin.php b/admin/code/SecurityAdmin.php index f1ac5815a..d87831cb9 100644 --- a/admin/code/SecurityAdmin.php +++ b/admin/code/SecurityAdmin.php @@ -100,7 +100,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { } /** - * @return FieldSet + * @return FieldList */ function RootForm() { $memberList = new MemberTableField( diff --git a/dev/BulkLoader.php b/dev/BulkLoader.php index f89ccbf91..e63771120 100644 --- a/dev/BulkLoader.php +++ b/dev/BulkLoader.php @@ -182,7 +182,7 @@ abstract class BulkLoader extends ViewableData { abstract protected function processRecord($record, $columnMap, &$result, $preview = false); /** - * Return a FieldSet containing all the options for this form; this + * Return a FieldList containing all the options for this form; this * doesn't include the actual upload field itself */ public function getOptionFields() {} diff --git a/docs/en/howto/csv-import.md b/docs/en/howto/csv-import.md index b5a96c66a..07fdf0d0a 100644 --- a/docs/en/howto/csv-import.md +++ b/docs/en/howto/csv-import.md @@ -78,10 +78,10 @@ You can have more customized logic and interface feedback through a custom contr $form = new Form( $this, 'Form', - new FieldSet( + new FieldList( new FileField('CsvFile', false) ), - new FieldSet( + new FieldList( new FormAction('doUpload', 'Upload') ), new RequiredFields() diff --git a/docs/en/reference/complextablefield.md b/docs/en/reference/complextablefield.md index e28052e7b..fdf98d93b 100644 --- a/docs/en/reference/complextablefield.md +++ b/docs/en/reference/complextablefield.md @@ -43,7 +43,7 @@ You can override this behaviour in various ways: 'MyName', 'Product', array('Price','Code'), - new FieldSet( + new FieldList( new TextField('Price') ) ) @@ -75,11 +75,11 @@ popup as there is more real-estate for you to play with. `[api:ComplexTableField]` gives you several options to do this. You can either -* Pass a FieldSet in the constructor. +* Pass a FieldList in the constructor. * Pass a String in the constructor. -The first will simply add the fieldset to the form, and populate it with the source class. -The second will call the String as a method on the source class (Which should return a FieldSet) of fields for the +The first will simply add the fieldlist to the form, and populate it with the source class. +The second will call the String as a method on the source class (Which should return a FieldList) of fields for the Popup. You can also customise Javascript which is loaded for the Lightbox. As Requirements::clear() is called when the popup is @@ -108,7 +108,7 @@ You'll have to do something like this in your form: $tableField->setParentClass(false); - $fields = new FieldSet( + $fields = new FieldList( new HiddenField('ID', ''), $tableField ); diff --git a/docs/en/reference/dataextension.md b/docs/en/reference/dataextension.md index a23bd6e8c..584c4bf39 100644 --- a/docs/en/reference/dataextension.md +++ b/docs/en/reference/dataextension.md @@ -88,7 +88,7 @@ extension: The $fields parameter is passed by reference, as it is an object. :::php - public function updateCMSFields(FieldSet $fields) { + public function updateCMSFields(FieldList $fields) { $fields->push(new TextField('Position', 'Position Title')); $fields->push(new ImageField('Image', 'Profile Image')); } diff --git a/docs/en/reference/dataobject.md b/docs/en/reference/dataobject.md index 66f2481db..d5f1269bc 100644 --- a/docs/en/reference/dataobject.md +++ b/docs/en/reference/dataobject.md @@ -13,7 +13,7 @@ A single database record & abstract class for the data-access-model. ## Basics The call to `DataObject->getCMSFields()` is the centerpiece of every data administration interface in SilverStripe, -which returns a `[api:FieldSet]`''. +which returns a `[api:FieldList]`''. :::php class MyPage extends Page { @@ -27,7 +27,7 @@ which returns a `[api:FieldSet]`''. ## Scaffolding Formfields -These calls retrieve a `[api:FieldSet]` for the area where you intend to work with the scaffolded form. +These calls retrieve a `[api:FieldList]` for the area where you intend to work with the scaffolded form. ### For the CMS diff --git a/docs/en/reference/form-field-types.md b/docs/en/reference/form-field-types.md index f4a939b54..9a7914ad0 100644 --- a/docs/en/reference/form-field-types.md +++ b/docs/en/reference/form-field-types.md @@ -30,7 +30,7 @@ given set of fields in a given set of tables * `[CompositeField](api:CompositeField)`: Base class for all fields that contain other fields. Uses `
` in template, but doesn't necessarily have any visible styling. * `[FieldGroup](api:FieldGroup)`: Same as CompositeField, but has default styling (indentation) attached in CMS-context. -* `[api:FieldSet]`: Basic container for sequential fields, or nested fields through CompositeField. Does NOT render a +* `[api:FieldList]`: Basic container for sequential fields, or nested fields through CompositeField. Does NOT render a ``. * `[TabSet](api:TabSet)` * `[Tab](api:Tab)` diff --git a/docs/en/reference/leftandmain.md b/docs/en/reference/leftandmain.md index 97c019507..b131d9f87 100644 --- a/docs/en/reference/leftandmain.md +++ b/docs/en/reference/leftandmain.md @@ -51,10 +51,10 @@ The PHP file defining your new subclass is the first step in the process. This */ public function getEditForm($id = null) { return new Form($this, "EditForm", - new FieldSet( + new FieldList( new ReadonlyField('id #',$id) ), - new FieldSet( + new FieldList( new FormAction('go') ) ); diff --git a/docs/en/reference/member.md b/docs/en/reference/member.md index f4e696884..c0bc0f97e 100644 --- a/docs/en/reference/member.md +++ b/docs/en/reference/member.md @@ -64,8 +64,8 @@ Note that if you want to look this class-name up, you can call Object::getCustom ## Overloading getCMSFields() If you overload the built-in function getCMSFields(), then you can change the form that is used to view & edit member -details in the newsletter system. This function returns a `[api:FieldSet]` object. You should generally start by calling -parent::getCMSFields() and manipulate the `[api:FieldSet]` from there. +details in the newsletter system. This function returns a `[api:FieldList]` object. You should generally start by calling +parent::getCMSFields() and manipulate the `[api:FieldList]` from there. :::php function getCMSFields() { @@ -106,10 +106,10 @@ things, you should add appropriate `[api:Permission::checkMember()]` calls to th * Modify the field set to be displayed in the CMS detail pop-up */ - function updateCMSFields(FieldSet $currentFields) { + function updateCMSFields(FieldList $currentFields) { // Only show the additional fields on an appropriate kind of use if(Permission::checkMember($this->owner->ID, "VIEW_FORUM")) { - // Edit the fieldset passed, adding or removing fields as necessary + // Edit the FieldList passed, adding or removing fields as necessary } } diff --git a/docs/en/reference/searchcontext.md b/docs/en/reference/searchcontext.md index e005a68ed..53abd480f 100644 --- a/docs/en/reference/searchcontext.md +++ b/docs/en/reference/searchcontext.md @@ -9,7 +9,7 @@ it just receives a set of search parameters and an object class it acts on. The default output of a `[api:SearchContext]` is either a `[api:SQLQuery]` object for further refinement, or a `[api:DataObject]` instance. -In case you need multiple contexts, consider namespacing your request parameters by using `FieldSet->namespace()` on +In case you need multiple contexts, consider namespacing your request parameters by using `FieldList->namespace()` on the $fields constructor parameter. `[api:SearchContext]` is mainly used by `[api:ModelAdmin]`, our generic data administration interface. Another @@ -71,7 +71,7 @@ method, we're building our own `getCustomSearchContext()` variant. $fields = $context->getSearchFields(); $form = new Form($this, "SearchForm", $fields, - new FieldSet( + new FieldList( new FormAction('doSearch') ) ); diff --git a/docs/en/reference/siteconfig.md b/docs/en/reference/siteconfig.md index b2e83f51e..47df15958 100644 --- a/docs/en/reference/siteconfig.md +++ b/docs/en/reference/siteconfig.md @@ -47,7 +47,7 @@ Create a mysite/code/CustomSiteConfig.php file. ); } - public function updateCMSFields(FieldSet $fields) { + public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab("Root.Main", new HTMLEditorField("FooterContent", "Footer Content")); } } diff --git a/docs/en/topics/form-validation.md b/docs/en/topics/form-validation.md index a93fc5632..f68a61ee2 100644 --- a/docs/en/topics/form-validation.md +++ b/docs/en/topics/form-validation.md @@ -14,11 +14,11 @@ class. :::php function Form() { $form = new Form($this, 'Form', - new FieldSet( + new FieldList( new TextField('MyRequiredField'), new TextField('MyOptionalField') ), - new FieldSet( + new FieldList( new FormAction('submit', 'Submit') ), new RequiredFields(array('MyRequiredField')) diff --git a/docs/en/topics/forms.md b/docs/en/topics/forms.md index 4c303f00f..a0499fe88 100644 --- a/docs/en/topics/forms.md +++ b/docs/en/topics/forms.md @@ -14,19 +14,19 @@ constructor takes the following arguments: * `$name`: This must be the name of the method on that controller that is called to return the form. The first two fields allow the form object to be re-created after submission. **It's vital that they are properly set - if you ever have problems with form action handler not working, check that these values are correct.** -* `$fields`: A `[api:FieldSet]` containing `[api:FormField]` instances make up fields in the form. -* `$actions`: A `[api:FieldSet]` containing the `[api:FormAction]` objects - the buttons at the bottom. +* `$fields`: A `[api:FieldList]` containing `[api:FormField]` instances make up fields in the form. +* `$actions`: A `[api:FieldList]` containing the `[api:FormAction]` objects - the buttons at the bottom. * `$validator`: An optional `[api:Validator]` for more information. Example: :::php function MyCustomForm() { - $fields = new FieldSet( + $fields = new FieldList( new EmailField("Email"), new EncryptField("Password") ); - $actions = new FieldSet(new FormAction("login", "Log in")); + $actions = new FieldList(new FormAction("login", "Log in")); return new Form($this, "MyCustomForm", $fields, $actions); } @@ -44,11 +44,11 @@ $name must be passed - their values depend on where the form is instantiated. :::php class MyForm extends Form { function __construct($controller, $name) { - $fields = new FieldSet( + $fields = new FieldList( new EmailField("Email"), new EncryptedField("Password") ); - $actions = new FieldSet(new FormAction("login", "Log in")); + $actions = new FieldList(new FormAction("login", "Log in")); parent::__construct($controller, $name, $fields, $actions); } @@ -77,13 +77,13 @@ Full overview at [form-field-types](/reference/form-field-types) ### Using Form Fields To get these fields automatically rendered into a form element, all you need to do is create a new instance of the -class, and add it to the fieldset of the form. +class, and add it to the fieldlist of the form. :::php $form = new Form( $controller = $this, $name = "SignupForm", - $fields = new FieldSet( + $fields = new FieldList( new TextField( $name = "FirstName", $title = "First name" @@ -91,7 +91,7 @@ class, and add it to the fieldset of the form. new TextField("Surname"), new EmailField("Email", "Email address"), ), - $actions = new FieldSet( + $actions = new FieldList( // List the action buttons here new FormAction("signup", "Sign up") ), @@ -109,7 +109,7 @@ Implementing the more complex fields requires extra arguments. $form = new Form( $controller = $this, $name = "SignupForm", - $fields = new FieldSet( + $fields = new FieldList( // List the your fields here new TextField( $name = "FirstName", @@ -123,7 +123,7 @@ Implementing the more complex fields requires extra arguments. $source = Geoip::getCountryDropDown(), $value = Geoip::visitor_country() ) - ), new FieldSet( + ), new FieldList( // List the action buttons here new FormAction("signup", "Sign up") @@ -141,7 +141,7 @@ Readonly on a Form $myForm->makeReadonly(); -Readonly on a FieldSet +Readonly on a FieldList :::php $myFieldSet->makeReadonly(); @@ -170,12 +170,12 @@ First of all, you need to create your form on it's own class, that way you can d class MyForm extends Form { function __construct($controller, $name) { - $fields = new FieldSet( + $fields = new FieldList( new TextField('FirstName', 'First name'), new EmailField('Email', 'Email address') ); - $actions = new FieldSet( + $actions = new FieldList( new FormAction('submit', 'Submit') ); @@ -280,5 +280,5 @@ Adds a new text field called FavouriteColour next to the Content field in the CM * `[api:Form]` * `[api:FormField]` -* `[api:FieldSet]` +* `[api:FieldList]` * `[api:FormAction]` \ No newline at end of file diff --git a/docs/en/topics/page-types.md b/docs/en/topics/page-types.md index 83b377283..6b5f0c492 100644 --- a/docs/en/topics/page-types.md +++ b/docs/en/topics/page-types.md @@ -78,7 +78,7 @@ See [form](/topics/forms) and [tutorial:2-extending-a-basic-site](/tutorials/2-e ### removeFieldFromTab() -Overloading `getCMSFields()` you can call `removeFieldFromTab()` on a `[api:FieldSet]` object. For example, if you don't +Overloading `getCMSFields()` you can call `removeFieldFromTab()` on a `[api:FieldList]` object. For example, if you don't want the MenuTitle field to show on your page, which is inherited from `[api:SiteTree]`. :::php @@ -105,7 +105,7 @@ required on a certain page-type. class MyForm extends Form { function __construct($controller, $name) { - // add a default FieldSet of form fields + // add a default FieldList of form fields $member = singleton('Member'); $fields = $member->formFields(); @@ -113,7 +113,7 @@ required on a certain page-type. // We don't want the Country field from our default set of fields, so we remove it. $fields->removeByName('Country'); - $actions = new FieldSet( + $actions = new FieldList( new FormAction('submit', 'Submit') ); diff --git a/docs/en/topics/widgets.md b/docs/en/topics/widgets.md index 0f18c5c7a..2bed3d007 100644 --- a/docs/en/topics/widgets.md +++ b/docs/en/topics/widgets.md @@ -85,7 +85,7 @@ Photos), and $description, a short description that will appear in the cms edito Flickr). The class may also specify functions to be used in the template like a page type can. If a Widget has configurable options, then it can specify a number of database fields to store these options in via the -static $db array, and also specify a getCMSFields function that returns a !FieldSet, much the same way as a page type +static $db array, and also specify a getCMSFields function that returns a !FieldList, much the same way as a page type does. An example widget is below: @@ -139,7 +139,7 @@ An example widget is below: } function getCMSFields() { - return new FieldSet( + return new FieldList( new TextField("User", "User"), new TextField("PhotoSet", "Photo Set"), new TextField("Tags", "Tags"), @@ -246,10 +246,10 @@ sure that your controller follows the usual naming conventions, and it will be a return new Form( $this, 'MyFormName', - new FieldSet( + new FieldList( new TextField('TestValue') ), - new FieldSet( + new FieldList( new FormAction('doAction') ) ); diff --git a/docs/en/tutorials/2-extending-a-basic-site.md b/docs/en/tutorials/2-extending-a-basic-site.md index 4c4a712c5..8b3672f88 100644 --- a/docs/en/tutorials/2-extending-a-basic-site.md +++ b/docs/en/tutorials/2-extending-a-basic-site.md @@ -192,7 +192,7 @@ Let's walk through this method. Firstly, we get the fields from the parent class; we want to add fields, not replace them. The *$fields* variable -returned is a `[api:FieldSet]` object. +returned is a `[api:FieldList]` object. :::php $fields->addFieldToTab('Root.Content', new DateField('Date'), 'Content'); diff --git a/docs/en/tutorials/3-forms.md b/docs/en/tutorials/3-forms.md index 59da9fc12..e53718e2f 100644 --- a/docs/en/tutorials/3-forms.md +++ b/docs/en/tutorials/3-forms.md @@ -33,7 +33,7 @@ the form in a method on *HomePage_Controller*. function BrowserPollForm() { // Create fields - $fields = new FieldSet( + $fields = new FieldList( new TextField('Name'), new OptionsetField('Browser', 'Your Favourite Browser', array( 'Firefox' => 'Firefox', @@ -46,7 +46,7 @@ the form in a method on *HomePage_Controller*. ); // Create actions - $actions = new FieldSet( + $actions = new FieldList( new FormAction('doBrowserPoll', 'Submit') ); @@ -63,7 +63,7 @@ Let's step through this code. :::php // Create fields - $fields = new FieldSet( + $fields = new FieldList( new TextField('Name'), new OptionsetField('Browser', 'Your Favourite Browser', array( 'Firefox' => 'Firefox', @@ -78,7 +78,7 @@ Let's step through this code. First we create our form fields. -We do this by creating a `[api:FieldSet]` and passing our fields as arguments. The first field is a new +We do this by creating a `[api:FieldList]` and passing our fields as arguments. The first field is a new `[api:TextField]` with the name 'Name'. There is a second argument when creating a field which specifies the text on the label of the field. If no second @@ -88,7 +88,7 @@ The second field we create is an `[api:OptionsetField]`. This is a dropdown, and array mapping the values to the options listed in the dropdown. :::php - $actions = new FieldSet( + $actions = new FieldList( new FormAction('doBrowserPoll', 'Submit'); ); @@ -100,7 +100,7 @@ button. Here we create a 'Submit' button which calls the 'doBrowserPoll' method, which we will create later. -All the form actions (in this case only one) are collected into a `[api:FieldSet]` object the same way we did with +All the form actions (in this case only one) are collected into a `[api:FieldList]` object the same way we did with the fields. :::php @@ -111,7 +111,7 @@ Finally we create the `[api:Form]` object and return it. The first argument is the controller that contains the form, in most cases '$this'. The second is the name of the method that returns the form, which is 'BrowserPollForm' in our case. The third and fourth arguments are the -FieldSets containing the fields and form actions respectively. +FieldLists containing the fields and form actions respectively. After creating the form function, we need to add the form to our home page template. @@ -139,7 +139,7 @@ Add the following code to the form style sheet: margin: 20px 10px 0 0; width: 20%; } - form fieldset { + form FieldList { border:0; } #BrowserPoll .message { diff --git a/docs/en/tutorials/4-site-search.md b/docs/en/tutorials/4-site-search.md index e706ad2c6..f24244528 100644 --- a/docs/en/tutorials/4-site-search.md +++ b/docs/en/tutorials/4-site-search.md @@ -54,11 +54,11 @@ search on your site is to create a form for the user to type their query. Create function SearchForm() { $searchText = isset($this->Query) ? $this->Query : 'Search'; - $fields = new FieldSet( + $fields = new FieldList( new TextField("Search", "", $searchText) ); - $actions = new FieldSet( + $actions = new FieldList( new FormAction('results', 'Go') ); diff --git a/docs/en/tutorials/5-dataobject-relationship-management.md b/docs/en/tutorials/5-dataobject-relationship-management.md index 5d0966057..963da07e4 100644 --- a/docs/en/tutorials/5-dataobject-relationship-management.md +++ b/docs/en/tutorials/5-dataobject-relationship-management.md @@ -83,7 +83,7 @@ The first step is to create the student and project objects. ); function getCMSFields_forPopup() { - $fields = new FieldSet(); + $fields = new FieldList(); $fields->push( new TextField( 'FirstName', 'First Name' ) ); $fields->push( new TextField( 'Lastname' ) ); @@ -153,7 +153,7 @@ Let’s walk through the parameters of the *HasOneComplexTableField* constructor You can also directly replace the last parameter by this code : :::php - new FieldSet( + new FieldList( new TextField( 'FirstName', 'First Name' ), new TextField( 'Lastname' ), new TextField( 'Nationality' ) @@ -381,7 +381,7 @@ The first step is to create the module object and set the relation with the *Pro ); function getCMSFields_forPopup() { - $fields = new FieldSet(); + $fields = new FieldList(); $fields->push( new TextField( 'Name' ) ); return $fields; } diff --git a/filesystem/File.php b/filesystem/File.php index 8ee575584..36a36c311 100644 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -775,7 +775,7 @@ class File extends DataObject { * * Needs to be enabled through {@link AssetAdmin::$metadata_upload_enabled} * - * @return FieldSet + * @return FieldList */ function uploadMetadataFields() { $fields = new FieldList(); diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 3e074893f..949e5ecef 100644 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -379,8 +379,8 @@ class Folder extends File { } /** - * Return the FieldSet used to edit this folder in the CMS. - * You can modify this fieldset by subclassing folder, or by creating a {@link DataExtension} + * Return the FieldList used to edit this folder in the CMS. + * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension} * and implemeting updateCMSFields(FieldList $fields) on that extension. */ function getCMSFields() { diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 4bebb9319..5294e4bb1 100644 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -32,7 +32,7 @@ class ComplexTableField extends TableListField { /** * Determines the fields of the detail pop-up form. It can take many forms: - * - A FieldSet object: Use that field set directly. + * - A FieldList object: Use that field set directly. * - A method name, eg, 'getCMSFields': Call that method on the child object to get the fields. */ protected $addTitle; @@ -330,7 +330,7 @@ JS; /** * @return FieldList */ - function createFieldSet() { + function createFieldList() { $fieldset = new FieldList(); foreach($this->fieldTypes as $key => $fieldType){ $fieldset->push(new $fieldType($key)); @@ -352,7 +352,7 @@ JS; * Return the object-specific fields for the given record, to be shown in the detail pop-up * * This won't include all the CTF-specific 'plumbing; this method is called by self::getFieldsFor() - * and the result is then processed further to get the actual FieldSet for the form. + * and the result is then processed further to get the actual FieldList for the form. * * The default implementation of this processes the value of $this->detailFormFields; consequently, if you want to * set the value of the fields to something that $this->detailFormFields doesn't allow, you can do so by overloading diff --git a/forms/FieldGroup.php b/forms/FieldGroup.php index ff6f21f3d..283455ecc 100644 --- a/forms/FieldGroup.php +++ b/forms/FieldGroup.php @@ -52,7 +52,7 @@ class FieldGroup extends CompositeField { if(is_array($arg1) || is_a($arg1, 'FieldSet')) { $fields = $arg1; - } else if(is_array($arg2) || is_a($arg2, 'FieldSet')) { + } else if(is_array($arg2) || is_a($arg2, 'FieldList')) { $this->title = $arg1; $fields = $arg2; diff --git a/forms/FieldList.php b/forms/FieldList.php old mode 100755 new mode 100644 index 1fa85b4fa..1c93b9609 --- a/forms/FieldList.php +++ b/forms/FieldList.php @@ -80,7 +80,7 @@ class FieldList extends ArrayList { } /** - * Add an extra field to a tab within this fieldset. + * Add an extra field to a tab within this FieldList. * This is most commonly used when overloading getCMSFields() * * @param string $tabName The name of the tab or tabset. Subtabs can be referred to as TabSet.Tab or TabSet.Tab.Subtab. @@ -101,7 +101,7 @@ class FieldList extends ArrayList { } /** - * Add a number of extra fields to a tab within this fieldset. + * Add a number of extra fields to a tab within this FieldList. * This is most commonly used when overloading getCMSFields() * * @param string $tabName The name of the tab or tabset. Subtabs can be referred to as TabSet.Tab or TabSet.Tab.Subtab. @@ -143,7 +143,7 @@ class FieldList extends ArrayList { } /** - * Removes a number of fields from a Tab/TabSet within this FieldSet. + * Removes a number of fields from a Tab/TabSet within this FieldList. * * @param string $tabName The name of the Tab or TabSet field * @param array $fields A list of fields, e.g. array('Name', 'Email') @@ -159,7 +159,7 @@ class FieldList extends ArrayList { } /** - * Remove a field from this FieldSet by Name. + * Remove a field from this FieldList by Name. * The field could also be inside a CompositeField. * * @param string $fieldName The name of the field or tab @@ -169,7 +169,7 @@ class FieldList extends ArrayList { */ public function removeByName($fieldName, $dataFieldOnly = false) { if(!$fieldName) { - user_error('FieldSet::removeByName() was called with a blank field name.', E_USER_WARNING); + user_error('FieldList::removeByName() was called with a blank field name.', E_USER_WARNING); } $this->flushFieldsCache(); @@ -257,7 +257,7 @@ class FieldList extends ArrayList { public function findOrMakeTab($tabName, $title = null) { $parts = explode('.',$tabName); - // We could have made this recursive, but I've chosen to keep all the logic code within FieldSet rather than add it to TabSet and Tab too. + // We could have made this recursive, but I've chosen to keep all the logic code within FieldList rather than add it to TabSet and Tab too. $currentPointer = $this; foreach($parts as $k => $part) { $parentPointer = $currentPointer; @@ -274,7 +274,7 @@ class FieldList extends ArrayList { $parentPointer->push($currentPointer); } else { $withName = ($parentPointer->hasMethod('Name')) ? " named '{$parentPointer->Name()}'" : null; - user_error("FieldSet::addFieldToTab() Tried to add a tab to object '{$parentPointer->class}'{$withName} - '$part' didn't exist.", E_USER_ERROR); + user_error("FieldList::addFieldToTab() Tried to add a tab to object '{$parentPointer->class}'{$withName} - '$part' didn't exist.", E_USER_ERROR); } } } @@ -324,7 +324,7 @@ class FieldList extends ArrayList { } /** - * Inserts a field before a particular field in a FieldSet. + * Inserts a field before a particular field in a FieldList. * * @param FormField $item The form field to insert * @param string $name Name of the field to insert before @@ -349,7 +349,7 @@ class FieldList extends ArrayList { } /** - * Inserts a field after a particular field in a FieldSet. + * Inserts a field after a particular field in a FieldList. * * @param FormField $item The form field to insert * @param string $name Name of the field to insert after @@ -374,7 +374,7 @@ class FieldList extends ArrayList { } /** - * Push a single field into this FieldSet instance. + * Push a single field into this FieldList instance. * * @param FormField $item The FormField to add * @param string $key An option array key (field name) @@ -386,7 +386,7 @@ class FieldList extends ArrayList { } /** - * Handler method called before the FieldSet is going to be manipulated. + * Handler method called before the FieldList is going to be manipulated. */ protected function onBeforeInsert($item) { $this->flushFieldsCache(); @@ -395,9 +395,9 @@ class FieldList extends ArrayList { /** - * Set the Form instance for this FieldSet. + * Set the Form instance for this FieldList. * - * @param Form $form The form to set this FieldSet to + * @param Form $form The form to set this FieldList to */ public function setForm($form) { foreach($this as $field) $field->setForm($form); @@ -406,7 +406,7 @@ class FieldList extends ArrayList { /** * Load the given data into this form. * - * @param data An map of data to load into the FieldSet + * @param data An map of data to load into the FieldList */ public function setValues($data) { foreach($this->dataFields() as $field) { @@ -420,7 +420,7 @@ class FieldList extends ArrayList { * in a form - including fields nested in {@link CompositeFields}. * Useful when doing custom field layouts. * - * @return FieldSet + * @return FieldList */ function HiddenFields() { $hiddenFields = new HiddenFieldSet(); @@ -434,10 +434,10 @@ class FieldList extends ArrayList { } /** - * Transform this FieldSet with a given tranform method, + * Transform this FieldList with a given tranform method, * e.g. $this->transform(new ReadonlyTransformation()) * - * @return FieldSet + * @return FieldList */ function transform($trans) { $this->flushFieldsCache(); @@ -461,9 +461,9 @@ class FieldList extends ArrayList { } /** - * Transforms this FieldSet instance to readonly. + * Transforms this FieldList instance to readonly. * - * @return FieldSet + * @return FieldList */ function makeReadonly() { return $this->transform(new ReadonlyTransformation()); @@ -481,7 +481,7 @@ class FieldList extends ArrayList { } /** - * Change the order of fields in this FieldSet by specifying an ordered list of field names. + * Change the order of fields in this FieldList by specifying an ordered list of field names. * This works well in conjunction with SilverStripe's scaffolding functions: take the scaffold, and * shuffle the fields around to the order that you want. * diff --git a/forms/Form.php b/forms/Form.php index d44218e4a..15f2641ff 100644 --- a/forms/Form.php +++ b/forms/Form.php @@ -142,8 +142,8 @@ class Form extends RequestHandler { * * @param Controller $controller The parent controller, necessary to create the appropriate form action tag. * @param String $name The method on the controller that will return this form object. - * @param FieldList $fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects. - * @param FieldList $actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects + * @param FieldList $fields All of the fields in the form - a {@link FieldList} of {@link FormField} objects. + * @param FieldList $actions All of the action buttons in the form - a {@link FieldLis} of {@link FormAction} objects * @param Validator $validator Override the default validator instance (Default: {@link RequiredFields}) */ function __construct($controller, $name, FieldList $fields, FieldList $actions, $validator = null) { @@ -338,7 +338,7 @@ class Form extends RequestHandler { /** * Handle a field request. * Uses {@link Form->dataFieldByName()} to find a matching field, - * and falls back to {@link FieldSet->fieldByName()} to look + * and falls back to {@link FieldList->fieldByName()} to look * for tabs instead. This means that if you have a tab and a * formfield with the same name, this method gives priority * to the formfield. @@ -460,7 +460,7 @@ class Form extends RequestHandler { /** * Generate extra special fields - namely the security token field (if required). * - * @return FieldSet + * @return FieldList */ public function getExtraFields() { $extraFields = new FieldList(); @@ -483,7 +483,7 @@ class Form extends RequestHandler { /** * Return the form's fields - used by the templates * - * @return FieldSet The form fields + * @return FieldList The form fields */ function Fields() { foreach($this->getExtraFields() as $field) { @@ -498,7 +498,7 @@ class Form extends RequestHandler { * in a form - including fields nested in {@link CompositeFields}. * Useful when doing custom field layouts. * - * @return FieldSet + * @return FieldList */ function HiddenFields() { return $this->fields->HiddenFields(); @@ -531,7 +531,7 @@ class Form extends RequestHandler { /** * Return the form's action buttons - used by the templates * - * @return FieldSet The action list + * @return FieldList The action list */ function Actions() { return $this->actions; @@ -916,7 +916,7 @@ class Form extends RequestHandler { * It will call $object->MyField to get the value of MyField. * If you passed an array, it will call $object[MyField]. * Doesn't save into dataless FormFields ({@link DatalessField}), - * as determined by {@link FieldSet->dataFields()}. + * as determined by {@link FieldList->dataFields()}. * * By default, if a field isn't set (as determined by isset()), * its value will not be saved to the field, retaining @@ -925,7 +925,7 @@ class Form extends RequestHandler { * Passed data should not be escaped, and is saved to the FormField instances unescaped. * Escaping happens automatically on saving the data through {@link saveInto()}. * - * @uses FieldSet->dataFields() + * @uses FieldList->dataFields() * @uses FormField->setValue() * * @param array|DataObject $data @@ -1022,7 +1022,7 @@ class Form extends RequestHandler { /** * Get the submitted data from this form through - * {@link FieldSet->dataFields()}, which filters out + * {@link FieldList->dataFields()}, which filters out * any form-specific data like form-actions. * Calls {@link FormField->dataValue()} on each field, * which returns a value suitable for insertion into a DataObject diff --git a/forms/FormField.php b/forms/FormField.php index e409c2105..fb16ce2cb 100644 --- a/forms/FormField.php +++ b/forms/FormField.php @@ -2,7 +2,7 @@ /** * Represents a field in a form. * - * A FieldSet contains a number of FormField objects which make up the whole of a form. + * A FieldList contains a number of FormField objects which make up the whole of a form. * In addition to single fields, FormField objects can be "composite", for example, the {@link TabSet} * field. Composite fields let us define complex forms without having to resort to custom HTML. * @@ -53,8 +53,8 @@ class FormField extends RequestHandler { protected $tabIndex; /** - * Stores a reference to the FieldSet that contains this object. - * @var FieldSet + * Stores a reference to the FieldList that contains this object. + * @var FieldList */ protected $containerFieldSet; @@ -480,7 +480,7 @@ HTML; * make sense for data-focused methods to look at them. By overloading hasData() to return false, * you can prevent any data-focused methods from looking at it. * - * @see FieldSet::collateDataFields() + * @see FieldList::collateDataFields() */ function hasData() { return true; } @@ -654,7 +654,7 @@ HTML; } /** - * Set the fieldset that contains this field. + * Set the FieldList that contains this field. * * @param FieldList $containerFieldSet */ diff --git a/forms/FormScaffolder.php b/forms/FormScaffolder.php index 1215e1d88..65f9d64cb 100644 --- a/forms/FormScaffolder.php +++ b/forms/FormScaffolder.php @@ -62,7 +62,7 @@ class FormScaffolder extends Object { * Depending on those parameters, the fields can be used in ajax-context, * contain {@link TabSet}s etc. * - * @return FieldSet + * @return FieldList */ public function getFieldSet() { $fields = new FieldList(); diff --git a/forms/OptionsetField.php b/forms/OptionsetField.php index fbf5c40e4..31746a4f5 100644 --- a/forms/OptionsetField.php +++ b/forms/OptionsetField.php @@ -34,7 +34,7 @@ * $map = $myDoSet->toDropDownMap(); * * // Instantiate the OptionsetField - * $fieldset = new FieldList( + * $FieldList = new FieldList( * new OptionsetField( * $name = "Foobar", * $title = "FooBar's optionset", diff --git a/forms/TabSet.php b/forms/TabSet.php index 460fda0dc..e7495863a 100644 --- a/forms/TabSet.php +++ b/forms/TabSet.php @@ -133,7 +133,7 @@ class TabSet extends CompositeField { } /** - * Inserts a field before a particular field in a FieldSet. + * Inserts a field before a particular field in a FieldList. * * @param FormField $item The form field to insert * @param string $name Name of the field to insert before diff --git a/forms/TableField.php b/forms/TableField.php index 462f28969..b30d702bf 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -20,7 +20,7 @@ * @param $sourceSort string * @param $sourceJoin string * - * @todo We should refactor this to support a single FieldSet instead of evaluated Strings for building FormFields + * @todo We should refactor this to support a single FieldList instead of evaluated Strings for building FormFields * * @package forms * @subpackage fields-relational @@ -43,7 +43,7 @@ class TableField extends TableListField { protected $filterValue = null; /** - * @var $fieldTypes FieldSet + * @var $fieldTypes FieldList * Caution: Use {@setExtraData()} instead of manually adding HiddenFields if you want to * preset relations or other default data. */ @@ -206,7 +206,7 @@ class TableField extends TableListField { /** * Generates a new {@link TableField} instance - * by loading a fieldset for this row into a temporary form. + * by loading a FieldList for this row into a temporary form. * * @param DataObject $dataObj * @return TableField_Item diff --git a/model/DataExtension.php b/model/DataExtension.php index da25a6ef0..2a3692b80 100644 --- a/model/DataExtension.php +++ b/model/DataExtension.php @@ -172,7 +172,7 @@ abstract class DataExtension extends Extension { * * Caution: Use {@link FieldList->addFieldToTab()} to add fields. * - * @param FieldList $fields FieldSet with a contained TabSet + * @param FieldList $fields FieldList with a contained TabSet */ function updateCMSFields(FieldList $fields) { } @@ -181,9 +181,9 @@ abstract class DataExtension extends Extension { * This function is used to provide modifications to the form used * for front end forms. {@link DataObject->getFrontEndFields()} * - * Caution: Use {@link FieldSet->push()} to add fields. + * Caution: Use {@link FieldList->push()} to add fields. * - * @param FieldList $fields FieldSet without TabSet nesting + * @param FieldList $fields FieldList without TabSet nesting */ function updateFrontEndFields(FieldList $fields) { } @@ -192,7 +192,7 @@ abstract class DataExtension extends Extension { * This is used to provide modifications to the form actions * used in the CMS. {@link DataObject->getCMSActions()}. * - * @param FieldList $actions FieldSet + * @param FieldList $actions FieldList */ function updateCMSActions(FieldList $actions) { } diff --git a/model/DataObject.php b/model/DataObject.php index 943942a71..7e6d976a2 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -1764,7 +1764,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @param array $_params * 'fieldClasses': Associative array of field names as keys and FormField classes as values * 'restrictFields': Numeric array of a field name whitelist - * @return FieldSet + * @return FieldList */ public function scaffoldSearchFields($_params = null) { $params = array_merge( @@ -1821,7 +1821,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @uses FormScaffolder * * @param array $_params Associative array passing through properties to {@link FormScaffolder}. - * @return FieldSet + * @return FieldList */ public function scaffoldFormFields($_params = null) { $params = array_merge( @@ -1867,7 +1867,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @see Good example of complex FormField building: SiteTree::getCMSFields() * * @param array $params See {@link scaffoldFormFields()} - * @return FieldSet Returns a TabSet for usage within the CMS - don't use for frontend forms. + * @return FieldList Returns a TabSet for usage within the CMS - don't use for frontend forms. */ public function getCMSFields($params = null) { $tabbedFields = $this->scaffoldFormFields(array_merge( @@ -1888,7 +1888,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * need to be overload by solid dataobject, so that the customised actions of that dataobject, * including that dataobject's extensions customised actions could be added to the EditForm. * - * @return an Empty FieldSet(); need to be overload by solid subclass + * @return an Empty FieldList(); need to be overload by solid subclass */ public function getCMSActions() { $actions = new FieldList(); @@ -1906,7 +1906,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @todo Decide on naming for "website|frontend|site|page" and stick with it in the API * * @param array $params See {@link scaffoldFormFields()} - * @return FieldSet Always returns a simple field collection without TabSet. + * @return FieldList Always returns a simple field collection without TabSet. */ public function getFrontEndFields($params = null) { $untabbedFields = $this->scaffoldFormFields($params); diff --git a/search/SearchContext.php b/search/SearchContext.php index 1a5406f1d..e05db8e2d 100644 --- a/search/SearchContext.php +++ b/search/SearchContext.php @@ -10,7 +10,7 @@ * search results, e.g. in a {@link TableListField} instance. * * In case you need multiple contexts, consider namespacing your request parameters -* by using {@link FieldSet->namespace()} on the $fields constructor parameter. +* by using {@link FieldList->namespace()} on the $fields constructor parameter. * * Each DataObject subclass can have multiple search contexts for different cases, * e.g. for a limited frontend search and a fully featured backend search. @@ -37,7 +37,7 @@ class SearchContext extends Object { * FormFields mapping to {@link DataObject::$db} properties * which are supposed to be searchable. * - * @var FieldSet + * @var FieldList */ protected $fields; @@ -79,7 +79,7 @@ class SearchContext extends Object { /** * Returns scaffolded search fields for UI. * - * @return FieldSet + * @return FieldList */ public function getSearchFields() { return ($this->fields) ? $this->fields : singleton($this->modelClass)->scaffoldSearchFields(); @@ -232,7 +232,7 @@ class SearchContext extends Object { /** * Get the list of searchable fields in the current search context. * - * @return FieldSet + * @return FieldList */ public function getFields() { return $this->fields; diff --git a/security/ChangePasswordForm.php b/security/ChangePasswordForm.php index 7e933b6d9..36261ad42 100644 --- a/security/ChangePasswordForm.php +++ b/security/ChangePasswordForm.php @@ -13,11 +13,11 @@ class ChangePasswordForm extends Form { * create the appropriate form action tag. * @param string $name The method on the controller that will return this * form object. - * @param FieldSet|FormField $fields All of the fields in the form - a - * {@link FieldSet} of {@link FormField} + * @param FieldList|FormField $fields All of the fields in the form - a + * {@link FieldList} of {@link FormField} * objects. - * @param FieldSet|FormAction $actions All of the action buttons in the - * form - a {@link FieldSet} of + * @param FieldList|FormAction $actions All of the action buttons in the + * form - a {@link FieldList} of */ function __construct($controller, $name, $fields = null, $actions = null) { if(isset($_REQUEST['BackURL'])) { diff --git a/security/Group.php b/security/Group.php index ebc5581cb..054586436 100644 --- a/security/Group.php +++ b/security/Group.php @@ -57,7 +57,7 @@ class Group extends DataObject { /** * Caution: Only call on instances, not through a singleton. * - * @return FieldSet + * @return FieldList */ public function getCMSFields() { Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js'); diff --git a/security/Member.php b/security/Member.php index 373d34462..3cc516cc1 100644 --- a/security/Member.php +++ b/security/Member.php @@ -504,7 +504,7 @@ class Member extends DataObject { * Returns the fields for the member form - used in the registration/profile module. * It should return fields that are editable by the admin and the logged-in user. * - * @return FieldSet Returns a {@link FieldSet} containing the fields for + * @return FieldList Returns a {@link FieldList} containing the fields for * the member form. */ public function getMemberFormFields() { @@ -1091,10 +1091,10 @@ class Member extends DataObject { /** - * Return a {@link FieldSet} of fields that would appropriate for editing + * Return a {@link FieldList} of fields that would appropriate for editing * this member. * - * @return FieldSet Return a FieldSet of fields that would appropriate for + * @return FieldList Return a FieldList of fields that would appropriate for * editing this member. */ public function getCMSFields() { diff --git a/security/MemberLoginForm.php b/security/MemberLoginForm.php index f88b88bc2..7f10328a8 100644 --- a/security/MemberLoginForm.php +++ b/security/MemberLoginForm.php @@ -21,11 +21,11 @@ class MemberLoginForm extends LoginForm { * create the appropriate form action tag. * @param string $name The method on the controller that will return this * form object. - * @param FieldSet|FormField $fields All of the fields in the form - a - * {@link FieldSet} of {@link FormField} + * @param FieldList|FormField $fields All of the fields in the form - a + * {@link FieldList} of {@link FormField} * objects. - * @param FieldSet|FormAction $actions All of the action buttons in the - * form - a {@link FieldSet} of + * @param FieldList|FormAction $actions All of the action buttons in the + * form - a {@link FieldList} of * {@link FormAction} objects * @param bool $checkCurrentUser If set to TRUE, it will be checked if a * the user is currently logged in, and if From e38dd08ea56b59688da48c7286355671938cbec1 Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Wed, 26 Oct 2011 19:09:04 +1300 Subject: [PATCH 4/4] MINOR: Fix docblocks to reference SS_List instead of (now deprecated) DataObjectSet where appropriate --- admin/code/CMSBatchAction.php | 2 +- admin/code/CMSBatchActionHandler.php | 2 +- admin/code/LeftAndMain.php | 2 +- admin/code/MemberTableField.php | 2 +- admin/code/ModelAdmin.php | 2 +- api/JSONDataFormatter.php | 4 ++-- api/RSSFeed.php | 6 +++--- api/RestfulServer.php | 8 ++++---- api/SapphireSoapServer.php | 2 +- api/XMLDataFormatter.php | 4 ++-- core/PaginatedList.php | 4 ++-- dev/BulkLoader.php | 16 ++++++++-------- dev/SapphireTest.php | 22 +++++++++++----------- forms/CheckboxSetField.php | 14 +++++++------- forms/ComplexTableField.php | 4 ++-- forms/TableField.php | 6 +++--- forms/TableListField.php | 20 ++++++++++---------- model/DataDifferencer.php | 2 +- model/DataList.php | 8 ++++---- model/Hierarchy.php | 14 +++++++------- model/SQLMap.php | 2 +- model/Versioned.php | 4 ++-- parsers/TextParser.php | 2 +- search/SearchContext.php | 4 ++-- security/Member.php | 6 +++--- security/Permission.php | 4 ++-- security/PermissionCheckboxSetField.php | 6 +++--- tests/forms/ComplexTableFieldTest.php | 2 +- tests/forms/TableListFieldTest.php | 2 +- 29 files changed, 88 insertions(+), 88 deletions(-) diff --git a/admin/code/CMSBatchAction.php b/admin/code/CMSBatchAction.php index 46370b6a0..14cb34dd1 100644 --- a/admin/code/CMSBatchAction.php +++ b/admin/code/CMSBatchAction.php @@ -32,7 +32,7 @@ abstract class CMSBatchAction extends Object { * Helper method for processing batch actions. * Returns a set of status-updating JavaScript to return to the CMS. * - * @param $objs The DataObjectSet of objects to perform this batch action + * @param $objs The SS_List of objects to perform this batch action * on. * @param $helperMethod The method to call on each of those objects. * @return JSON encoded map in the following format: diff --git a/admin/code/CMSBatchActionHandler.php b/admin/code/CMSBatchActionHandler.php index f26f833fe..3f58f2715 100644 --- a/admin/code/CMSBatchActionHandler.php +++ b/admin/code/CMSBatchActionHandler.php @@ -166,7 +166,7 @@ class CMSBatchActionHandler extends RequestHandler { } /** - * Return a DataObjectSet of ArrayData objects containing the following pieces of info + * Return a SS_List of ArrayData objects containing the following pieces of info * about each batch action: * - Link * - Title diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index 8a7cc0dea..f24c54f0d 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -393,7 +393,7 @@ class LeftAndMain extends Controller { * Returns the main menu of the CMS. This is also used by init() * to work out which sections the user has access to. * - * @return DataObjectSet + * @return SS_List */ public function MainMenu() { // Don't accidentally return a menu if you're not logged in - it's used to determine access. diff --git a/admin/code/MemberTableField.php b/admin/code/MemberTableField.php index f64fd6f26..238d812c8 100644 --- a/admin/code/MemberTableField.php +++ b/admin/code/MemberTableField.php @@ -54,7 +54,7 @@ class MemberTableField extends ComplexTableField { * @param Controller $controller Controller class which created this field * @param string $name Name of the field (e.g. "Members") * @param mixed $group Can be the ID of a Group instance, or a Group instance itself - * @param DataObjectSet $members Optional set of Members to set as the source items for this field + * @param SS_List $members Optional set of Members to set as the source items for this field * @param boolean $hidePassword Hide the password field or not in the summary? */ function __construct($controller, $name, $group = null, $members = null, $hidePassword = true) { diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index 46d079227..32c3b6a0e 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -244,7 +244,7 @@ abstract class ModelAdmin extends LeftAndMain { * Returns managed models' create, search, and import forms * @uses SearchContext * @uses SearchFilter - * @return DataObjectSet of forms + * @return SS_List of forms */ protected function getModelForms() { $models = $this->getManagedModels(); diff --git a/api/JSONDataFormatter.php b/api/JSONDataFormatter.php index 5557a74f2..6ef831ab4 100644 --- a/api/JSONDataFormatter.php +++ b/api/JSONDataFormatter.php @@ -116,9 +116,9 @@ class JSONDataFormatter extends DataFormatter { } /** - * Generate a JSON representation of the given {@link DataObjectSet}. + * Generate a JSON representation of the given {@link SS_List}. * - * @param DataObjectSet $set + * @param SS_List $set * @return String XML */ public function convertDataObjectSet(SS_List $set, $fields = null) { diff --git a/api/RSSFeed.php b/api/RSSFeed.php index 5e3d2911b..bccff5a0e 100644 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -20,7 +20,7 @@ class RSSFeed extends ViewableData { /** * Holds the feed entries * - * @var DataObjectSet + * @var SS_List */ protected $entries; @@ -83,7 +83,7 @@ class RSSFeed extends ViewableData { /** * Constructor * - * @param DataObjectSet $entries RSS feed entries + * @param SS_List $entries RSS feed entries * @param string $link Link to the feed * @param string $title Title of the feed * @param string $description Description of the field @@ -134,7 +134,7 @@ class RSSFeed extends ViewableData { /** * Get the RSS feed entries * - * @return DataObjectSet Returns the {@link RSSFeed_Entry} objects. + * @return SS_List Returns the {@link RSSFeed_Entry} objects. */ function Entries() { $output = new ArrayList(); diff --git a/api/RestfulServer.php b/api/RestfulServer.php index 7ccc71f9e..88e03522d 100644 --- a/api/RestfulServer.php +++ b/api/RestfulServer.php @@ -217,7 +217,7 @@ class RestfulServer extends Controller { $responseFormatter = $this->getResponseDataFormatter(); if(!$responseFormatter) return $this->unsupportedMediaType(); - // $obj can be either a DataObject or a DataObjectSet, + // $obj can be either a DataObject or a SS_List, // depending on the request if($id) { // Format: /api/v1// @@ -262,7 +262,7 @@ class RestfulServer extends Controller { * * @param string $className * @param array $params - * @return DataObjectSet + * @return SS_List */ protected function getSearchQuery($className, $params = null, $sort = null, $limit = null, $existingQuery = null) { if(singleton($className)->hasMethod('getRestfulSearchContext')) { @@ -592,7 +592,7 @@ class RestfulServer extends Controller { } /** - * Restful server handler for a DataObjectSet + * Restful server handler for a SS_List * * @package sapphire * @subpackage api @@ -630,7 +630,7 @@ class RestfulServer_Item { $funcName = $request('Relation'); $relation = $this->item->$funcName(); - if($relation instanceof DataObjectSet) return new RestfulServer_List($relation); + if($relation instanceof SS_List) return new RestfulServer_List($relation); else return new RestfulServer_Item($relation); } } diff --git a/api/SapphireSoapServer.php b/api/SapphireSoapServer.php index df6945b78..8bb6265b3 100644 --- a/api/SapphireSoapServer.php +++ b/api/SapphireSoapServer.php @@ -45,7 +45,7 @@ class SapphireSoapServer extends Controller { } /** - * @return DataObjectSet Collection of ArrayData elements describing + * @return SS_List Collection of ArrayData elements describing * the method (keys: 'Name', 'Arguments', 'ReturnType') */ function Methods() { diff --git a/api/XMLDataFormatter.php b/api/XMLDataFormatter.php index dd49e930a..ca5b1a590 100644 --- a/api/XMLDataFormatter.php +++ b/api/XMLDataFormatter.php @@ -127,9 +127,9 @@ class XMLDataFormatter extends DataFormatter { } /** - * Generate an XML representation of the given {@link DataObjectSet}. + * Generate an XML representation of the given {@link SS_List}. * - * @param DataObjectSet $set + * @param SS_List $set * @return String XML */ public function convertDataObjectSet(SS_List $set, $fields = null) { diff --git a/core/PaginatedList.php b/core/PaginatedList.php index 6d85822e5..f6fe65f0b 100644 --- a/core/PaginatedList.php +++ b/core/PaginatedList.php @@ -162,7 +162,7 @@ class PaginatedList extends SS_ListDecorator { * around the current page. * * @param int $max - * @return DataObjectSet + * @return SS_List */ public function Pages($max = null) { $result = new ArrayList(); @@ -229,7 +229,7 @@ class PaginatedList extends SS_ListDecorator { * @param int $context The number of pages to display around the current * page. The number should be event, as half the number of each pages * are displayed on either side of the current one. - * @return DataObjectSet + * @return SS_List */ public function PaginationSummary($context = 4) { $result = new ArrayList(); diff --git a/dev/BulkLoader.php b/dev/BulkLoader.php index e63771120..1b6fa1e93 100644 --- a/dev/BulkLoader.php +++ b/dev/BulkLoader.php @@ -326,24 +326,24 @@ class BulkLoader_Result extends Object { * Returns all created objects. Each object might * contain specific importer feedback in the "_BulkLoaderMessage" property. * - * @return DataObjectSet + * @return ArrayList */ public function Created() { - return $this->mapToDataObjectSet($this->created); + return $this->mapToArrayList($this->created); } /** - * @return DataObjectSet + * @return ArrayList */ public function Updated() { - return $this->mapToDataObjectSet($this->updated); + return $this->mapToArrayList($this->updated); } /** - * @return DataObjectSet + * @return ArrayList */ public function Deleted() { - return $this->mapToDataObjectSet($this->deleted); + return $this->mapToArrayList($this->deleted); } /** @@ -396,9 +396,9 @@ class BulkLoader_Result extends Object { /** * @param $arr Array containing ID and ClassName maps - * @return DataObjectSet + * @return ArrayList */ - protected function mapToDataObjectSet($arr) { + protected function mapToArrayList($arr) { $set = new ArrayList(); foreach($arr as $arrItem) { $obj = DataObject::get_by_id($arrItem['ClassName'], $arrItem['ID']); diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 6c6798af3..dab997cd4 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -513,12 +513,12 @@ class SapphireTest extends PHPUnit_Framework_TestCase { /** - * Assert that the given {@link DataObjectSet} includes DataObjects matching the given key-value + * Assert that the given {@link SS_List} includes DataObjects matching the given key-value * pairs. Each match must correspond to 1 distinct record. * * @param $matches The patterns to match. Each pattern is a map of key-value pairs. You can * either pass a single pattern or an array of patterns. - * @param $dataObjectSet The {@link DataObjectSet} to test. + * @param $dataObjectSet The {@link SS_List} to test. * * Examples * -------- @@ -550,8 +550,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase { // We couldn't find a match - assertion failed if(!$matched) { throw new PHPUnit_Framework_AssertionFailedError( - "Failed asserting that the DataObjectSet contains an item matching " - . var_export($match, true) . "\n\nIn the following DataObjectSet:\n" + "Failed asserting that the SS_List contains an item matching " + . var_export($match, true) . "\n\nIn the following SS_List:\n" . $this->DOSSummaryForMatch($dataObjectSet, $match) ); } @@ -560,12 +560,12 @@ class SapphireTest extends PHPUnit_Framework_TestCase { } /** - * Assert that the given {@link DataObjectSet} includes only DataObjects matching the given + * Assert that the given {@link SS_List} includes only DataObjects matching the given * key-value pairs. Each match must correspond to 1 distinct record. * * @param $matches The patterns to match. Each pattern is a map of key-value pairs. You can * either pass a single pattern or an array of patterns. - * @param $dataObjectSet The {@link DataObjectSet} to test. + * @param $dataObjectSet The {@link SS_List} to test. * * Example * -------- @@ -596,8 +596,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase { // We couldn't find a match - assertion failed if(!$matched) { throw new PHPUnit_Framework_AssertionFailedError( - "Failed asserting that the DataObjectSet contains an item matching " - . var_export($match, true) . "\n\nIn the following DataObjectSet:\n" + "Failed asserting that the SS_List contains an item matching " + . var_export($match, true) . "\n\nIn the following SS_List:\n" . $this->DOSSummaryForMatch($dataObjectSet, $match) ); } @@ -607,18 +607,18 @@ class SapphireTest extends PHPUnit_Framework_TestCase { if($extracted) { // If we didn't break by this point then we couldn't find a match throw new PHPUnit_Framework_AssertionFailedError( - "Failed asserting that the DataObjectSet contained only the given items, the " + "Failed asserting that the SS_List contained only the given items, the " . "following items were left over:\n" . var_export($extracted, true) ); } } /** - * Assert that the every record in the given {@link DataObjectSet} matches the given key-value + * Assert that the every record in the given {@link SS_List} matches the given key-value * pairs. * * @param $match The pattern to match. The pattern is a map of key-value pairs. - * @param $dataObjectSet The {@link DataObjectSet} to test. + * @param $dataObjectSet The {@link SS_List} to test. * * Example * -------- diff --git a/forms/CheckboxSetField.php b/forms/CheckboxSetField.php index ef5a1635e..86eeaceb6 100644 --- a/forms/CheckboxSetField.php +++ b/forms/CheckboxSetField.php @@ -25,7 +25,7 @@ * * If the field name matches a database field, a comma-separated list of values will be saved to that field. The keys can be text or numbers. * * @todo Document the different source data that can be used - * with this form field - e.g ComponentSet, DataObjectSet, + * with this form field - e.g ComponentSet, ArrayList, * array. Is it also appropriate to accept so many different * types of data when just using an array would be appropriate? * @@ -46,7 +46,7 @@ class CheckboxSetField extends OptionsetField { /** * @todo Explain different source data that can be used with this field, - * e.g. SQLMap, DataObjectSet or an array. + * e.g. SQLMap, ArrayList or an array. * * @todo Should use CheckboxField FieldHolder rather than constructing own markup. */ @@ -76,7 +76,7 @@ class CheckboxSetField extends OptionsetField { $items = $values; } else { // Source and values are DataObject sets. - if($values && is_a($values, 'DataObjectSet')) { + if($values && is_a($values, 'SS_List')) { foreach($values as $object) { if(is_a($object, 'DataObject')) { $items[] = $object->ID; @@ -88,8 +88,8 @@ class CheckboxSetField extends OptionsetField { } } } else { - // Sometimes we pass a singluar default value thats ! an array && !DataObjectSet - if(is_a($values, 'DataObjectSet') || is_array($values)) { + // Sometimes we pass a singluar default value thats ! an array && !SS_List + if(is_a($values, 'SS_List') || is_array($values)) { $items = $values; } else { $items = explode(',', $values); @@ -247,7 +247,7 @@ class CheckboxSetField extends OptionsetField { if($items) { // Items is a DO Set - if(is_a($items, 'DataObjectSet')) { + if(is_a($items, 'SS_List')) { foreach($items as $item) { $data[] = $item->Title; } @@ -264,7 +264,7 @@ class CheckboxSetField extends OptionsetField { $data[] = $item['Title']; } elseif(is_array($this->source) && !empty($this->source[$item])) { $data[] = $this->source[$item]; - } elseif(is_a($this->source, 'DataObjectSet')) { + } elseif(is_a($this->source, 'SS_List')) { $data[] = $sourceTitles[$item]; } else { $data[] = $item; diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 5294e4bb1..f7697c557 100644 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -245,7 +245,7 @@ JS; } /** - * @return DataObjectSet + * @return SS_List */ function Items() { $sourceItems = $this->sourceItems(); @@ -709,7 +709,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest { /** * Method handles pagination in asset popup. * - * @return Object DataObjectSet + * @return Object SS_List */ function Pagination() { diff --git a/forms/TableField.php b/forms/TableField.php index b30d702bf..3480e8b56 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -116,7 +116,7 @@ class TableField extends TableListField { /** * Displays the headings on the template * - * @return DataObjectSet + * @return SS_List */ function Headings() { $i=0; @@ -147,7 +147,7 @@ class TableField extends TableListField { * it generates the rows from array data instead. * Used in the formfield template to iterate over each row. * - * @return DataObjectSet Collection of {@link TableField_Item} + * @return SS_List Collection of {@link TableField_Item} */ function Items() { // holds TableField_Item instances @@ -341,7 +341,7 @@ class TableField extends TableListField { * Called on save, it creates the appropriate objects and writes them * to the database. * - * @param DataObjectSet $dataObjects + * @param SS_List $dataObjects * @param boolean $existingValues If set to TRUE, it tries to find existing objects * based on the database IDs passed as array keys in $dataObjects parameter. * If set to FALSE, it will always create new object (default: TRUE) diff --git a/forms/TableListField.php b/forms/TableListField.php index c4d730a0a..c00cde642 100644 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -266,7 +266,7 @@ class TableListField extends FormField { function sourceClass() { $list = $this->getDataList(); if(method_exists($list, 'dataClass')) return $list->dataClass(); - // Failover for DataObjectSet + // Failover for SS_List else return get_class($list->First()); } @@ -364,7 +364,7 @@ JS * Dummy function to get number of actions originally generated in * TableListField_Item. * - * @return DataObjectSet + * @return SS_List */ function Actions() { $allowedActions = new ArrayList(); @@ -396,10 +396,10 @@ JS 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 - if($items instanceof DataObjectSet) { + if($items instanceof SS_List) { $this->dataList = $items; } else { - user_error('TableList::setCustomSourceItems() should be passed a DataObjectSet', E_USER_WARNING); + user_error('TableList::setCustomSourceItems() should be passed a SS_List', E_USER_WARNING); } } @@ -407,10 +407,10 @@ JS * Get items, with sort & limit applied */ function sourceItems() { - // get items (this may actually be a DataObjectSet) + // get items (this may actually be a SS_List) $items = clone $this->getDataList(); - // TODO: Sorting could be implemented on regular DataObjectSets. + // TODO: Sorting could be implemented on regular SS_Lists. if(method_exists($items,'canSortBy') && isset($_REQUEST['ctf'][$this->Name()]['sort'])) { $sort = $_REQUEST['ctf'][$this->Name()]['sort']; // TODO: sort direction @@ -434,7 +434,7 @@ JS } /** - * Return a DataObjectSet of TableListField_Item objects, suitable for display in the template. + * Return a SS_List of TableListField_Item objects, suitable for display in the template. */ function Items() { $fieldItems = new ArrayList(); @@ -586,7 +586,7 @@ JS } /** - * @param DataObjectSet $items Only used to pass grouped sourceItems for creating + * @param SS_List $items Only used to pass grouped sourceItems for creating * partial summaries. */ function SummaryFields($items = null) { @@ -1275,7 +1275,7 @@ JS * Requires {@link Markable()} to return TRUE. * This is only functional with JavaScript enabled. * - * @return DataObjectSet of ArrayData objects + * @return SS_List of ArrayData objects */ function SelectOptions(){ if(!$this->selectOptions) return; @@ -1427,7 +1427,7 @@ class TableListField_Item extends ViewableData { * See TableListField->Action for a similiar dummy-function to work * around template-inheritance issues. * - * @return DataObjectSet + * @return SS_List */ function Actions() { $allowedActions = new ArrayList(); diff --git a/model/DataDifferencer.php b/model/DataDifferencer.php index 4ef11b516..6e4bf13fa 100644 --- a/model/DataDifferencer.php +++ b/model/DataDifferencer.php @@ -131,7 +131,7 @@ class DataDifferencer extends ViewableData { } /** - * Get a DataObjectSet of the changed fields. + * Get a SS_List of the changed fields. * Each element is an array data containing * - Name: The field name * - Title: The human-readable field title diff --git a/model/DataList.php b/model/DataList.php index 8b4df8834..73c5a3359 100644 --- a/model/DataList.php +++ b/model/DataList.php @@ -10,7 +10,7 @@ class DataList extends ViewableData implements SS_List { protected $dataClass; /** - * The {@link DataQuery} object responsible for getting this DataObjectSet's records + * The {@link DataQuery} object responsible for getting this DataList's records */ protected $dataQuery; @@ -178,9 +178,9 @@ class DataList extends ViewableData implements SS_List { } /** - * Returns an Iterator for this DataObjectSet. - * This function allows you to use DataObjectSets in foreach loops - * @return DataObjectSet_Iterator + * Returns an Iterator for this DataList. + * This function allows you to use DataLists in foreach loops + * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->toArray()); diff --git a/model/Hierarchy.php b/model/Hierarchy.php index 55af6e1f4..4bebe312a 100644 --- a/model/Hierarchy.php +++ b/model/Hierarchy.php @@ -394,7 +394,7 @@ class Hierarchy extends DataExtension { /** * Get the children for this DataObject. - * @return DataObjectSet + * @return SS_List */ public function Children() { if(!(isset($this->_cache_children) && $this->_cache_children)) { @@ -413,7 +413,7 @@ class Hierarchy extends DataExtension { /** * Return all children, including those 'not in menus'. - * @return DataObjectSet + * @return SS_List */ public function AllChildren() { return $this->owner->stageChildren(true); @@ -425,7 +425,7 @@ class Hierarchy extends DataExtension { * Added children will be marked as "AddedToStage" * Modified children will be marked as "ModifiedOnStage" * Everything else has "SameOnStage" set, as an indicator that this information has been looked up. - * @return DataObjectSet + * @return SS_List */ public function AllChildrenIncludingDeleted($context = null) { return $this->doAllChildrenIncludingDeleted($context); @@ -435,7 +435,7 @@ class Hierarchy extends DataExtension { * @see AllChildrenIncludingDeleted * * @param unknown_type $context - * @return DataObjectSet + * @return SS_List */ public function doAllChildrenIncludingDeleted($context = null) { if(!$this->owner) user_error('Hierarchy::doAllChildrenIncludingDeleted() called without $this->owner'); @@ -515,7 +515,7 @@ class Hierarchy extends DataExtension { * * @param showAll Inlcude all of the elements, even those not shown in the menus. * (only applicable when extension is applied to {@link SiteTree}). - * @return DataObjectSet + * @return SS_List */ public function stageChildren($showAll = false) { if($this->owner->db('ShowInMenus')) { @@ -540,7 +540,7 @@ class Hierarchy extends DataExtension { * @param boolean $showAll Include all of the elements, even those not shown in the menus. * (only applicable when extension is applied to {@link SiteTree}). * @param boolean $onlyDeletedFromStage Only return items that have been deleted from stage - * @return DataObjectSet + * @return SS_List */ public function liveChildren($showAll = false, $onlyDeletedFromStage = false) { if(!$this->owner->hasExtension('Versioned')) throw new Exception('Hierarchy->liveChildren() only works with Versioned extension applied'); @@ -587,7 +587,7 @@ class Hierarchy extends DataExtension { /** * Return all the parents of this class in a set ordered from the lowest to highest parent. * - * @return DataObjectSet + * @return SS_List */ public function getAncestors() { $ancestors = new ArrayList(); diff --git a/model/SQLMap.php b/model/SQLMap.php index 5e997e788..cbeda009f 100644 --- a/model/SQLMap.php +++ b/model/SQLMap.php @@ -57,7 +57,7 @@ class SQLMap extends Object implements IteratorAggregate { /** * Get the items in this class. - * @return DataObjectSet + * @return SS_List */ public function getItems() { $this->genItems(); diff --git a/model/Versioned.php b/model/Versioned.php index 4989c9a76..a4f7698b1 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -908,8 +908,8 @@ class Versioned extends DataExtension { * @param string $sort A sort expression to be inserted into the ORDER BY clause. * @param string $join A join expression, such as LEFT JOIN or INNER JOIN * @param int $limit A limit on the number of records returned from the database. - * @param string $containerClass The container class for the result set (default is DataObjectSet) - * @return DataObjectSet + * @param string $containerClass The container class for the result set (default is DataList) + * @return SS_List */ static function get_by_stage($class, $stage, $filter = '', $sort = '', $join = '', $limit = '', $containerClass = 'DataList') { $result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass); diff --git a/parsers/TextParser.php b/parsers/TextParser.php index 867417dca..6c2c8477b 100644 --- a/parsers/TextParser.php +++ b/parsers/TextParser.php @@ -17,7 +17,7 @@ * You should run Covert::raw2xml or whatever is appropriate before using it. * * Optionally (but recommended), is creating a static usable_tags method, - * which will return a DataObjectSet of all the usable tags that can be parsed. + * which will return a SS_List of all the usable tags that can be parsed. * This will (mostly) be used to create helper blocks - telling users what things will be parsed. * Again, @see BBCodeParser for an example of the syntax * diff --git a/search/SearchContext.php b/search/SearchContext.php index e05db8e2d..39d349bf0 100644 --- a/search/SearchContext.php +++ b/search/SearchContext.php @@ -6,7 +6,7 @@ * it just receives a set of search parameters and an object class it acts on. * * The default output of a SearchContext is either a {@link SQLQuery} object -* for further refinement, or a {@link DataObjectSet} that can be used to display +* for further refinement, or a {@link SS_List} that can be used to display * search results, e.g. in a {@link TableListField} instance. * * In case you need multiple contexts, consider namespacing your request parameters @@ -159,7 +159,7 @@ class SearchContext extends Object { * @param array $searchParams * @param string|array $sort * @param string|array $limit - * @return DataObjectSet + * @return SS_List */ public function getResults($searchParams, $sort = false, $limit = false) { $searchParams = array_filter($searchParams, array($this,'clearEmptySearchFields')); diff --git a/security/Member.php b/security/Member.php index 3cc516cc1..aba02e3ab 100644 --- a/security/Member.php +++ b/security/Member.php @@ -717,7 +717,7 @@ class Member extends DataObject { /** * Check if the member is in one of the given groups. * - * @param array|DataObjectSet $groups Collection of {@link Group} DataObjects to check + * @param array|SS_List $groups Collection of {@link Group} DataObjects to check * @param boolean $strict Only determine direct group membership if set to true (Default: false) * @return bool Returns TRUE if the member is in one of the given groups, otherwise FALSE. */ @@ -1001,7 +1001,7 @@ class Member extends DataObject { $groupIDList = array(); - if(is_a($groups, 'DataObjectSet')) { + if(is_a($groups, 'SS_List')) { foreach( $groups as $group ) $groupIDList[] = $group->ID; } elseif(is_array($groups)) { @@ -1047,7 +1047,7 @@ class Member extends DataObject { $groupIDList = array(); - if(is_a($groups, 'DataObjectSet')) { + if(is_a($groups, 'SS_List')) { foreach($groups as $group) { $groupIDList[] = $group->ID; } diff --git a/security/Permission.php b/security/Permission.php index 1ef70dab0..cefd22413 100644 --- a/security/Permission.php +++ b/security/Permission.php @@ -374,7 +374,7 @@ class Permission extends DataObject { * Returns all members for a specific permission. * * @param $code String|array Either a single permission code, or a list of permission codes - * @return DataObjectSet Returns a set of member that have the specified + * @return SS_List Returns a set of member that have the specified * permission. */ public static function get_members_by_permission($code) { @@ -405,7 +405,7 @@ class Permission extends DataObject { /** * Return all of the groups that have one of the given permission codes * @param $codes array|string Either a single permission code, or an array of permission codes - * @return DataObjectSet The matching group objects + * @return SS_List The matching group objects */ static function get_groups_by_permission($codes) { if(!is_array($codes)) $codes = array($codes); diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index 334fe14e6..4a25d2b7f 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -19,7 +19,7 @@ class PermissionCheckboxSetField extends FormField { protected $hiddenPermissions = array(); /** - * @var DataObjectSet + * @var SS_List */ protected $records = null; @@ -33,7 +33,7 @@ class PermissionCheckboxSetField extends FormField { * @param String $title * @param String $managedClass * @param String $filterField - * @param Group|DataObjectSet $records One or more {@link Group} or {@link PermissionRole} records + * @param Group|SS_List $records One or more {@link Group} or {@link PermissionRole} records * used to determine permission checkboxes. * Caution: saveInto() can only be used with a single record, all inherited permissions will be marked readonly. * Setting multiple groups only makes sense in a readonly context. (Optional) @@ -47,7 +47,7 @@ class PermissionCheckboxSetField extends FormField { } elseif($records instanceof Group) { $this->records = new ArrayList(array($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 SS_List of Group records'); } // Get all available codes in the system as a categorized nested array diff --git a/tests/forms/ComplexTableFieldTest.php b/tests/forms/ComplexTableFieldTest.php index 68e20272c..37e1d1a30 100644 --- a/tests/forms/ComplexTableFieldTest.php +++ b/tests/forms/ComplexTableFieldTest.php @@ -36,7 +36,7 @@ class ComplexTableFieldTest extends FunctionalTest { $parser = new CSSContentParser($field->FieldHolder()); $this->assertEquals(count($parser->getBySelector('tbody tr')), 2, 'There are 2 players (rows) in the table'); - $this->assertEquals($field->Items()->Count(), 2, 'There are 2 CTF items in the DataObjectSet'); + $this->assertEquals($field->Items()->Count(), 2, 'There are 2 CTF items in the SS_List'); } function testAddingManyManyNewPlayer() { diff --git a/tests/forms/TableListFieldTest.php b/tests/forms/TableListFieldTest.php index dd3129634..dbc8ad09a 100644 --- a/tests/forms/TableListFieldTest.php +++ b/tests/forms/TableListFieldTest.php @@ -294,7 +294,7 @@ class TableListFieldTest extends SapphireTest { } /** - * Check that a DataObjectSet can be passed to TableListField + * Check that a SS_List can be passed to TableListField */ function testDataObjectSet() { $one = new TableListFieldTest_Obj;