PageRenderTime 26ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/en/appendices/2-5-migration-guide.rst

https://gitlab.com/albertkeba/docs
ReStructuredText | 268 lines | 190 code | 78 blank | 0 comment | 0 complexity | e620ad6dd2e7d92a1995c48df4034559 MD5 | raw file
  1. 2.5 Migration Guide
  2. ###################
  3. CakePHP 2.5 is a fully API compatible upgrade from 2.4. This page outlines
  4. the changes and improvements made in 2.5.
  5. Cache
  6. =====
  7. - A new adapter has been added for ``Memcached``. This new adapter uses
  8. ext/memcached instead of ext/memcache. It supports improved performance and
  9. shared persistent connections.
  10. - The ``Memcache`` adapter is now deprecated in favor of ``Memcached``.
  11. - :php:meth:`Cache::remember()` was added.
  12. - :php:meth:`Cache::config()` now accepts ``database`` key when used with
  13. :php:class:`RedisEngine` in order to use non-default database number.
  14. Console
  15. =======
  16. SchemaShell
  17. -----------
  18. - The ``create`` and ``update`` subcommands now have a ``yes`` option. The
  19. ``yes`` option allows you to skip the various interactive questions forcing
  20. a yes reply.
  21. CompletionShell
  22. ---------------
  23. - The :doc:`CompletionShell </console-and-shells/completion-shell>` was added.
  24. It aims to assist in the creation of autocompletion libraries for shell
  25. environments like bash, or zsh. No shell scripts are included in CakePHP, but
  26. the underlying tools are now available.
  27. Controller
  28. ==========
  29. AuthComponent
  30. -------------
  31. - ``loggedIn()`` is now deprecated and will be removed in 3.0.
  32. - When using ``ajaxLogin``, AuthComponent will now return a ``403`` status code
  33. instead of a ``200`` when the user is un-authenticated.
  34. CookieComponent
  35. ---------------
  36. - :php:class:`CookieComponent` can use the new AES-256 encryption offered by
  37. :php:class:`Security`. You can enable this by calling
  38. :php:meth:`CookieComponent::type()` with 'aes'.
  39. RequestHandlerComponent
  40. -----------------------
  41. - :php:meth:`RequestHandlerComponent::renderAs()` no longer sets ``Controller::$ext``.
  42. It caused problems when using a non default extension for views.
  43. AclComponent
  44. ------------
  45. - ACL node lookup failures are now logged directly. The call to
  46. ``trigger_error()`` has been removed.
  47. Scaffold
  48. --------
  49. - Dynamic Scaffold is now deprecated and will be removed in 3.0.
  50. Core
  51. ====
  52. App
  53. ---
  54. - ``App::pluginPath()`` has been deprecated. ``CakePlugin::path()`` should be used instead.
  55. CakePlugin
  56. ----------
  57. - :php:meth:`CakePlugin::loadAll()` now merges the defaults and plugin specific options as
  58. intuitively expected. See the test cases for details.
  59. Event
  60. =====
  61. EventManager
  62. ------------
  63. Events bound to the global manager are now fired in priority order with events
  64. bound to a local manager. This can cause listeners to be fired in a different
  65. order than they were in previous releases. Instead of all global listeners being triggered,
  66. and then instance listeners being fired afterwards, the two sets of listeners
  67. are combined into one list of listeners based on their priorities and then fired
  68. as one set. Global listeners of a given priority are still fired before instance
  69. listeners.
  70. I18n
  71. ====
  72. - The :php:class:`I18n` class has several new constants. These constants allow you
  73. to replace hardcoded integers with readable values. e.g.
  74. ``I18n::LC_MESSAGES``.
  75. Model
  76. =====
  77. - Unsigned integers are now supported by datasources that provide them (MySQL).
  78. You can set the ``unsigned`` option to true in your schema/fixture files to
  79. start using this feature.
  80. - Joins included in queries are now added **after** joins from associations are
  81. added. This makes it easier to join tables that depend on generated
  82. associations.
  83. Network
  84. =======
  85. CakeEmail
  86. ---------
  87. - Email addresses in CakeEmail are now validated with ``filter_var`` by default.
  88. This relaxes the email address rules allowing internal email addresses like
  89. ``root@localhost`` for example.
  90. - You can now specify ``layout`` key in email config array without having to
  91. specify ``template`` key.
  92. CakeRequest
  93. -----------
  94. - :php:meth:`CakeRequest::addDetector()` now supports ``options`` which
  95. accepts an array of valid options when creating param based detectors.
  96. - ``CakeRequest::onlyAllow()`` has been deprecated. As replacement a new method named
  97. :php:meth:`CakeRequest::allowMethod()` has been added with identical functionality.
  98. The new method name is more intuitive and better conveys what the method does.
  99. CakeSession
  100. -----------
  101. - Sessions will not be started if they are known to be empty. If the session
  102. cookie cannot be found, a session will not be started until a write operation
  103. is done.
  104. Routing
  105. =======
  106. Router
  107. ------
  108. - :php:meth:`Router::mapResources()` accepts ``connectOptions`` key in the
  109. ``$options`` argument. See :ref:`custom-rest-routing` for more details.
  110. Utility
  111. =======
  112. Debugger
  113. --------
  114. - ``Debugger::dump()`` and ``Debugger::log()`` now support a ``$depth``
  115. parameter. This new parameter makes it easy to output more deeply nested
  116. object structures.
  117. Hash
  118. ----
  119. - :php:meth:`Hash::insert()` and :php:meth:`Hash::remove()` now support matcher
  120. expressions in their path selectors.
  121. File
  122. ----
  123. - :php:meth:`File::replaceText()` was added. This method allows you to easily
  124. replace text in a file using ``str_replace``.
  125. Folder
  126. ------
  127. - :php:meth:`Folder::addPathElement()` now accepts an array for the ``$element``
  128. parameter.
  129. Security
  130. --------
  131. - :php:meth:`Security::encrypt()` and :php:meth:`Security::decrypt()` were
  132. added. These methods expose a very simple API to access AES-256 symmetric encryption.
  133. They should be used in favour of the ``cipher()`` and ``rijndael()`` methods.
  134. Validation
  135. ----------
  136. - The third param for :php:meth:`Validation::inList()` and :php:meth:`Validation::multiple()` has been
  137. modified from `$strict` to `$caseInsensitive`. `$strict` has been dropped as it was working incorrectly
  138. and could easily backfire.
  139. You can now set this param to true for case insensitive comparison. The default is false and
  140. will compare the value and list case sensitive as before.
  141. - ``$mimeTypes`` parameter of :php:meth:`Validation::mimeType()` can also be a
  142. regex string. Also now when ``$mimeTypes`` is an array it's values are lowercased.
  143. Logging
  144. =======
  145. FileLog
  146. -------
  147. - CakeLog does not auto-configure itself anymore. As a result log files will not be auto-created
  148. anymore if no stream is listening. Please make sure you got at least one default engine set up
  149. if you want to listen to all types and levels.
  150. Error
  151. =====
  152. ExceptionRenderer
  153. -----------------
  154. The ExceptionRenderer now populates the error templates with "code", "message" and "url" variables.
  155. "name" has been deprecated but is still available. This unifies the variables across all error templates.
  156. Testing
  157. =======
  158. - Fixture files can now be placed in sub-directories. You can use fixtures in
  159. subdirectories by including the directory name after the ``.``. For example,
  160. `app.my_dir/article` will load ``App/Test/Fixture/my_dir/ArticleFixture``. It
  161. should be noted that the fixture directory will not be inflected or modified
  162. in any way.
  163. - Fixtures can now set ``$canUseMemory`` to false to disable the memory storage
  164. engine being used in MySQL.
  165. View
  166. ====
  167. View
  168. ----
  169. - ``$title_for_layout`` is deprecated. Use ``$this->fetch('title');`` and
  170. ``$this->assign('title', 'your-page-title');`` instead.
  171. - :php:meth:`View::get()` now accepts a second argument to provide a default
  172. value.
  173. FormHelper
  174. ----------
  175. - FormHelper will now generate file inputs for ``binary`` field types now.
  176. - :php:meth:`FormHelper::end()` had a second parameter added. This parameter
  177. lets you pass additional properties to the fields used for securing forms in
  178. conjunction with SecurityComponent.
  179. - :php:meth:`FormHelper::end()` and :php:meth:`FormHelper::secure()` allow you
  180. to pass additional options that are turned into attributes on the generated
  181. hidden inputs. This is useful when you want to use the HTML5 ``form`` attribute.
  182. - :php:meth:`FormHelper::postLink()` now allows you to buffer the generated form
  183. tag instead of returning it with the link. This helps avoiding nested form tags.
  184. PaginationHelper
  185. ----------------
  186. - :php:meth:`PaginatorHelper::sort()` now has a ``lock`` option to create pagination sort links with
  187. the default direction only.
  188. ScaffoldView
  189. ------------
  190. - Dynamic Scaffold is now deprecated and will be removed in 3.0.