The CakePHP core team is happy to announce the immediate availability of CakePHP 3.9.0. This is the first stable release of 3.9.0. 3.9.0 provides a number improvements both large and small to CakePHP.
This release is the last planned feature release for 3.x. Going forward the core team will be focusing 4.x releases going forward. As per our release timelines 3.9 will continue to receive bug fixes until June 15 2021.
Upgrading to 3.9.0
You can use composer to upgrade to CakePHP 3.9.0::
php composer.phar require --update-with-dependencies "cakephp/cakephp:3.9.*"
error()will no longer accept
nullvalues in the
messageparameter in 4.0.
- Using a comma separated string for
$fixturesin test cases is deprecated. Instead use an array, or implement the new
getFixtures()method on your test case classes.
Validator::errors()was renamed to
FormHelper::create()now emits deprecation warnings when the
$contextparameter is a boolean or string. These values trigger fatal errors in 4.0 and will need to be updated before upgrading.
- The magic method signature for
FunctionBuilder::cast([...])is deprecated. Use
zendframeworkpackage has been replaced with laminas which provides backwards-compatible classes.
What's new in 3.9.0?
The migration guide has a complete list of what's new in 3.9.0. We recommend you give that page a read when upgrading. A few highlights from 3.9.0 are:
- Command classes can implement the
defaultName()method to overwrite the conventions based CLI name.
Query::orderDesc()now accept Closure's as their field enabling you to use build complex order expressions with the provided
Cake\Datasource\SimplePaginatorwas added. This class makes paginating very large results more efficient. It skips running the potentially expensive
count()query. If you only use 'next' and 'previous' navigation in your pagination controls this class can be a good solution.
Cake\Http\Client\Response::isSuccess()was backported from 4.0
Cake\Http\Middleware\CspMiddlewarewas backported from 4.0
BaseApplication::addOptionalPlugin()was added. This method handles loading plugins, and handling errors for plugins that may not exist because they are dev dependencies.
- The i18n global functions now only return strings. The changes made to 4.0 to remove the null return value when no translation string is provide have been backported to 3.9.
- Lenient parsing can be disabled for
disableLenientParsing(). The default is enabled - the same as IntlDateFormatter.
Table::saveManyOrFail()method has been added that will throw
PersistenceFailedExceptionwith the specific entity that failed in case of an error. The entities are saved within a transaction.
Table::deleteManyOrFail()methods have been added for removing many entities at once including callbacks. The entities are removed within a transaction.
random_int()with PHP 5.6 insted of
mt_rand(). This adds a dependency on paragonie/random_compat which implements it for PHP 5.6.
Contributors to 3.9.0
Thank you to all the contributors that helped make 3.9 happen:
- Cauan Cabral
- Corey Taylor
- Edgaras Janušauskas
- Erwane Breton
- Florian Krämer
- Frank de Graaf (Phally)
- Jorge González
- Mark Scherer
- Mark Story
- Robert Pustułka
- Val Bancer
- Victor Eduardo de Assis
As always, a huge thanks to all the community members that helped make this release happen by reporting issues and sending pull requests. 3.9.0 is a large release and would not have been possible without the community support and feedback.