6.0 Migration Guide
CakePHP 6.0 contains breaking changes, and is not backwards compatible with 5.x. Before attempting to upgrade to 6.0 first upgrade to 5.2+ and resolve all deprecation warnings.
Behavior Changes
- All datasource connections require the
username,passwordanddatabasekeys as default values have been removed to prevent accidental privileged user usage. - The
ORM.mapJsonTypeForSqliteconfiguration option has been removed. The SQLite adapter will map all columns withjsonin their names to theJsonTypeby default. Cake\View\Widget\FileWidgetwas removed as it was redundant. The standard input widget will be used for file inputs in 6.x.Text::uuid()now generates UUID v7 complaint strings instead of UUID v4.Cake\Event\Event::getSubject()can now returnnullif the event has no subject instead of throwing an exception.
Breaking Changes
Renamed Methods
Methods starting with a _ have been renamed to remove the leading underscore. You can find a full list of adjusted methods in the cakephp/upgrade tool.
Some methods have also been renamed to better reflect their purpose. These are:
Cake\Console\ConsoleOutput_write()has been renamed towriteStream()
Cake\Form\Form_execute()has been renamed toprocess()
Cake\Http\Client_sendRequest()has been renamed toprocessRequest()
Cake\Http\ServerRequest_is()has been renamed toisType()
Cake\Http\Client\Adapter\Stream_send()has been renamed toprocessRequest()
Cake\I18n\DateFormatTrait_parseDateTime()has been renamed toprocessDateTime()
Cake\Mailer\Transport\SmtpTransport_connect()has been renamed toconnectSmtp()_disconnect()has been renamed todisconnectSmtp()
Cake\ORM\Table_saveMany()has been renamed todoSaveMany()_deleteMany()has been renamed todoDeleteMany()
Cake\ORM\Behavior\TreeBehavior_moveUp()has been renamed todoMoveUp()_moveDown()has been renamed todoMoveDown()_removeFromTree()has been renamed todoRemoveFromTree()
Cake\ORM\Association\HasMany_unlink()has been renamed todoUnlink()
Cake\ORM\Query\SelectQuery_decorateResults()has been renamed toormDecorateResults()_execute()has been renamed toormExecute()
Cake\Utility\Hash_filter()has been renamed todoFilter()_merge()has been renamed todoMerge()
Cake\Utility\Text_wordWrap()has been renamed todoWordWrap()
Cake\Utility\Xml_fromArray()has been renamed todoFromArray()_toArray()has been renamed todoToArray()
Cake\View\View_render()has been renamed torenderFile()
Cake\View\Helper\PaginatorHelper_numbers()has been renamed tobuildNumbers()
Event
- The signature of
EventManagerInterface::on()has changed. The 2nd and 3rd parameters have been swapped. Calls which pass an options array as the 2nd argument will need to be updated to pass it as the 3rd argument instead or use named parameters.
Datasource
Datasource/Paging/PaginatedInterfacenow extendsIteratorAggregateinstead ofTraversable.EntityTrait::isEmpty()has been dropped in favor ofhasValue().
Http
- Using
$request->getParam('?')to get the query params is no longer possible. Use$request->getQueryParams()instead. - The methods
_getCookies(),_getJson(),_getXml(),_getHeaders()and_getBody()have been removed. Use/Overwrite their non-prefixed public alternative instead.
ORM
- The
_accessibleproperty inside Entities has been renamed topatchableto better reflect its purpose. setAccessmethod has been renamed tosetPatchable.getAccessiblemethod has been renamed togetPatchable.isAccessiblemethod has been renamed toisPatchable.- The
accessibleFieldsoption used in e.g. ORM Queries has been renamed topatchableFields.
Utility
- The default placeholder format for
Text::insert()has been changed. They now use{foo}instead of:foo. You can get the old behavior by using thebeforeandafterkeys of$options.
View
'escape'/'escapeTitle'keys have now been separated cleanly intoescapefor escaping content/labels, and'escapeAttributes'for HTML attributes respectively. They also don't overlap anymore, so if you need to prevent escaping on content and attributes, make sure to set them both to false.titlehas been renamed tocontentin scopes where this is not an attribute, but content or label element, specifically:'item'/itemWithoutLinkbreadcrumb templates.multicheckboxTitletemplate of FormHelper is nowmulticheckboxLabel.