CakePHP 2.4 is a fully API compatible upgrade from 2.3. This page outlines the changes and improvements made in 2.4.
- Logged notice messages will now be colourized in terminals that support colours.
- ConsoleShell is now deprecated.
cake schema generate
now supports the--exclude
parameter.- The constant
CAKEPHP_SHELL
is now deprecated and will be removed in CakePHP 3.0.
cake bake model
now supports baking$behaviors
. Finding lft, rght and parent_id fields in your table it will add the Tree behavior, for example. You can also extend the ModelTask to support your own behaviors to be recognized.cake bake
for views, models, controllers, tests and fixtures now supports a-f
or--force
parameter to force overwriting of files.- Tasks in core can now be aliased in the same way you would Helpers, Components and Behaviors
cake bake fixture
now supports a--schema
parameter to allow baking all fixtures with noninteractive "all" while using schema import.
- Constants
IMAGES_URL
,JS_URL
,CSS_URL
have been deprecated and replaced with config variablesApp.imageBaseUrl
,App.jsBaseUrl
,App.cssBaseUrl
respectively. - Constants
IMAGES
,JS
,CSS
have been deprecated.
- :php
Object::log()
had the$scope
parameter added.
- AuthComponent now supports proper stateless mode when using 'Basic' or 'Digest' authenticators. Starting of session can be prevented by setting :php
AuthComponent::$sessionKey
to false. Also now when using only 'Basic' or 'Digest' you are no longer redirected to login page. For more info check the :phpAuthComponent
page. - Property :php
AuthComponent::$authError
can be set to booleanfalse
to suppress flash message from being displayed.
- Authenticating objects now use new password hasher objects for password hash generation and checking. See
hashing-passwords
for more info.
- DbAcl now uses
INNER
joins instead ofLEFT
joins. This improves performance for some database vendors.
- :php
Model::save()
, :phpModel::saveField()
, :phpModel::saveAll()
, :phpModel::saveAssociated()
, :phpModel::saveMany()
now take a newcounterCache
option. You can set it to false to avoid updating counter cache values for the particular save operation. - :php
Model::clear()
was added.
- The Mysql, Postgres, and Sqlserver datasources now support a 'settings' array in the connection definition. This key => value pair will be issued as
SET
commands when the connection is created. - The MySQL driver now supports SSL options.
- JSONP support has been added to :php
JsonView
. - The
_serialize
key now supports renaming serialized variables. - When debug > 0 JSON will be pretty printed.
- The
_serialize
key now supports renaming serialized variables. - When debug > 0 XML will be pretty printed.
- The API for :php
HtmlHelper::css()
has been been simplified. You can now provide an array of options as the second argument. When you do, therel
attribute defaults to 'stylesheet'. - New option
escapeTitle
added to :phpHtmlHelper::link()
to control escaping of only link title and not attributes.
- :php
TextHelper::autoParagraph()
has been added. It allows to automatically convert text into HTML paragraphs.
- :php
PaginatorHelper::param()
has been added. - The first page no longer contains
/page:1
or?page=1
in the URL. This helps prevent duplicate content issues where you would need to use canonical or noindex otherwise.
- The
round
option was added to :phpFormHelper::dateTime()
. Can be set toup
ordown
to force rounding in either direction. Defaults to null which rounds half up according tointerval
.
- :php
CakeRequest::param()
has been added. - :php
CakeRequest::is()
has been modified to support an array of types and will return true if the request matches any type. - :php
CakeRequest::isAll()
has been added to check that a request matches all the given types.
- :php
CakeResponse::location()
has been added to get or set the redirect location header.
- Logged email messages now have the scope of
email
by default. If you are not seeing email contents in your logs, be sure to add theemail
scope to your logging configuration. - :php
CakeEmail::emailPattern()
was added. This method can be used to relax email validation rules. This is useful when dealing with certain Japanese hosts that allow non-compliant addresses to be used. - :php
CakeEmail::attachments()
now allows you to provide the file contents directly using thedata
key. - Configuration data is now correctly merged with transport classes.
- :php
HttpSocket::patch()
has been added.
ell
is now the default locale for Greek as specified by ISO 639-3 andgre
its alias. The locale folders have to be adjusted accordingly (from /Locale/gre/ to /Locale/ell/).fas
is now the default locale for Farsi as specified by ISO 639-3 andper
its alias. The locale folders have to be adjusted accordingly (from /Locale/per/ to /Locale/fas/).sme
is now the default locale for Sami as specified by ISO 639-3 andsmi
its alias. The locale folders have to be adjusted accordingly (from /Locale/smi/ to /Locale/sme/).mkd
replacesmk
as default locale for Macedonian as specified by ISO 639-3. The corresponding locale folders have to be adjusted, as well.- Catalog code
in
has been dropped in favor ofid
(Indonesian),e
has been dropped in favor ofel
(Greek),n
has been dropped in favor ofnl
(Dutch),p
has been dropped in favor ofpl
(Polish),sz
has been dropped in favor ofse
(Sami). - Kazakh has been added with
kaz
as locale andkk
as catalog code. - Kalaallisut has been added with
kal
as locale andkl
as catalog code. - The constant
DEFAULT_LANGUAGE
has been deprecated in favor of Configure valueConfig.language
.
- Log engines do not need the suffix
Log
anymore in their setup configuration. So for the FileLog engine it suffices to define'engine' => 'File'
now. This unifies the way engines are named in configuration (see Cache engines for example). Note: If you have a Log engine likeDatabaseLogger
that does not follow the convention to use a suffixLog
for your class name you have to adjust your class name toDatabaseLog
. You should also avoid class names likeSomeLogLog
which include the suffix twice at the end.
- Two new config options
size
androtate
have been added forFileLog <file-log>
engine. - In debug mode missing directories will now be automatically created to avoid unnecessary errors thrown.
- The new logging engine
SyslogLog <syslog-log>
was added to stream messages to syslog.
- In debug mode missing directories will now be automatically created to avoid unnecessary errors thrown.
- :php
pr()
no longer outputs HTML when running in CLI mode.
Sanitize
class has been deprecated.
- :php
Validation::date()
now supports they
andym
formats. - The country code of :php
Validation::phone()
for Canada has been changed fromcan
toca
to unify the country codes for validation methods according to ISO 3166 (two letter codes).
- The currencies
AUD
,CAD
andJPY
have been added. - The symbols for
GBP
andEUR
are now UTF-8. If you upgrade a non-UTF-8 application, make sure that you update the static$_currencies
attribute with the appropriate HTML entity symbols (£
and€
) before you use those currencies. - The
fractionExponent
option was added to :phpCakeNumber::currency()
.
- :php
CakeTime::isPast()
and :phpCakeTime::isFuture()
were added. - :php
CakeTime::timeAgoInWords()
has two new options to customize the output strings:relativeString
(defaults to%s ago
) andabsoluteString
(defaults toon %s
). - :php
CakeTime::timeAgoInWords()
uses fuzzy terms when time is below thresholds.
- New option
pretty
has been added to :phpXml::fromArray()
to return nicely formatted Xml
- New configuration option
skipLog
has been added, to allow skipping certain Exception types to be logged.Configure::write('Exception.skipLog', array('NotFoundException', 'ForbiddenException'));
will avoid these exceptions and the ones extending them to be be logged when'Exception.log'
config istrue
- :php
Router::fullBaseUrl()
was added together withApp.fullBaseUrl
Configure value. They replace :phpFULL_BASE_URL
which is now deprecated. - :php
Router::parse()
now parses query string arguments.