silverstripe-framework/docs/en/changelogs/3.1.0.md
Hamish Friedlander 27113f82c3 API Make DataList and ArrayList immutable
In 3.0 there was some confusion about whether DataLists and ArrayLists
were mutable or not. If DataLists were immutable, they'd return the result, and your code
would look like

  $list = $list->filter(....);

If DataLists were mutable, they'd operate on themselves, returning nothing, and your code
would look like

 $list->filter(....);

This makes all DataLists and ArrayList immutable for all _searching_ operations.
Operations on DataList that modify the underlying SQL data store remain mutating.

- These functions no longer mutate the existing object, and if you do not capture the value
returned by them will have no effect:

  ArrayList#reverse
  ArrayList#sort
  ArrayList#filter
  ArrayList#exclude

  DataList#dataQuery (use DataList#alterDataQuery to modify dataQuery in a safe manner)
  DataList#where
  DataList#limit
  DataList#sort
  DataList#addFilter
  DataList#applyFilterContext
  DataList#innerJoin
  DataList#leftJoin
  DataList#find
  DataList#byIDs
  DataList#reverse

- DataList#setDataQueryParam has been added as syntactic sugar around the most common
cause of accessing the dataQuery directly - setting query parameters

- RelationList#setForeignID has been removed. Always use RelationList#forForeignID
when querying, and overload RelationList#foreignIDList when subclassing.

- Relatedly,the protected variable RelationList->foreignID has been removed, as the ID is
now stored on a query parameter. Use RelationList#getForeignID to read it.
2012-12-14 13:30:35 +13:00

3.8 KiB

3.1.0 (unreleased)

Overview

Upgrading

  • TableListField, ComplexTableField, TableField, HasOneComplexTableField, HasManyComplexTableField and ManyManyComplexTableField have been removed from the core and placed into a module called "legacytablefields" located at https://github.com/silverstripe-labs/legacytablefields
  • prototype.js and behaviour.js have been removed from the core, they are no longer used. If you have custom code relying on these two libraries, please update your code to include the files yourself
  • Object::has_extension() and Object::add_extension() deprecated in favour of using late static binding, please use {class}::has_extension() and {class}::add_extension() instead, where {class} is the class name of your DataObject class.
  • Removed SiteTree.MetaTitle and SiteTree.MetaKeywords since they are irrelevant in terms of SEO (1, 2) and general page informancy
  • Deprecated Profiler class, use third-party solutions like xhprof
  • Removed defunct or unnecessary debug GET parameters: debug_profile, debug_memory, profile_trace, debug_javascript, debug_behaviour
  • Removed Member_ProfileForm, use CMSProfileController instead
  • SiteTree::$nested_urls enabled by default. To disable, call SiteTree::disable_nested_urls().
  • Removed CMS permission checks from File->canEdit() and File->canDelete(). If you have unsecured controllers relying on these permissions, please override them through a DataExtension.
  • Moved email bounce handling to new "emailbouncehandler" module, including Email_BounceHandler and Email_BounceRecord classes, as well as the Member->Bounced property.
  • Deprecated global email methods htmlEmail() and plaintextEmail, as well as various email helper methods like encodeMultipart(). Use the Email API, or the Mailer class where applicable.
  • Removed non-functional $inlineImages option for sending emails
  • Removed support for keyed arrays in SelectionGroup, use new SelectionGroup_Item object to populate the list instead (see API docs).
  • Removed Form->Name(): Use getName()
  • Removed FormField->setContainerFieldSet(): Use setContainerFieldList()
  • Removed FormField->rootFieldSet(): Use rootFieldList()
  • Removed Group::map(): Use DataList::("Group")->map()
  • Removed Member->generateAutologinHash(): Tokens are no longer saved directly into the database in plaintext. Use the return value of the Member::generateAutologinTokenAndHash to get the token
  • Removed Member->sendInfo(): use Member_ChangePasswordEmail or Member_ForgotPasswordEmail directly
  • Removed SQLMap::map(): Use DataList::("Member")->map()
  • Removed SQLMap::mapInGroups(): Use Member::map_in_groups()
  • Removed PasswordEncryptor::register()/unregister(): Use config system instead
  • Methods on DataList and ArrayList that used to both modify the existing list & return a new version now just return a new version. Make sure you change statements like $list->filter(...) to $list = $list->filter(...) for these methods:
    • ArrayList#reverse
    • ArrayList#sort
    • ArrayList#filter
    • ArrayList#exclude
    • DataList#where
    • DataList#limit
    • DataList#sort
    • DataList#addFilter
    • DataList#applyFilterContext
    • DataList#innerJoin
    • DataList#leftJoin
    • DataList#find
    • DataList#byIDs
    • DataList#reverse
  • DataList#dataQuery has been changed to return a clone of the query, and so can't be used to modify the list's query directly. Use DataList#alterDataQuery instead to modify dataQuery in a safe manner.