Stable Release in branch 3.4
3.4.14
Released 20 May 2018
(8 years ago)
SoftwareCakePHP
Version3.4
Status
End of life
Supported
PHP versions
PHP 5.6-7.4
Initial release3.4.0
12 Feb 2017
(9 years ago)
Latest release3.4.14
20 May 2018
(8 years ago)
End of security fixesUnavailable
Release noteshttps://github.com/cakephp/cakephp/releases/tag/3.4.14
Source codehttps://github.com/cakephp/cakephp/tree/3.4.14
Documentationhttps://book.cakephp.org/3/en/index.html
Downloadhttps://book.cakephp.org/3/en/installation.html
CakePHP 3.4 ReleasesView full list

What Is New in CakePHP 3.4

CakePHP 3.4 delivers incremental improvements and deprecations that prepare the codebase for future major releases. The focus is on refining existing components and enhancing developer experience with more flexible tools.

Category Key Changes
New Features New hasMany('Through') association type, FormHelper template system overhaul.
Improvements Enhanced Collection methods, better session handling, improved fixture loading.
Deprecated Several methods in TableRegistry, Network\Session, and static methods in Log\Log.
Bug Fixes Various fixes across ORM, Database, and View layers.

How Are Database Associations More Powerful Now?

The ORM now supports a hasMany('Through') association. This is useful for modeling relationships where a join table contains additional data or metadata, bridging two distant tables.

In practice, this works similarly to hasOne('Through') but returns multiple related entities. You define it in your table class's initialize method. This matters because it simplifies complex data models that previously required custom finder logic or intermediate associations.

// Example: A User hasMany Articles through UserArticles
$this->hasMany('Articles', [
    'through' => 'UserArticles',
]);

What Changed in the FormHelper Template System?

The FormHelper received a significant internal refactor for its template system. The new structure provides clearer separation between form elements, labels, and error messages, making customization more intuitive.

Instead of a single complex template string, you now work with a template array. This gives you finer control over the HTML wrapper for each part of a form input. The old input template is split into label, input, error, and formGroup templates.

// New template array structure
$_defaultWidgetTemplates = [
    'label' => '<label{{attrs}}>{{text}}</label>',
    'input' => '<input{{attrs}}/>',
    'error' => '<div class="error-message"{{attrs}}>{{content}}</div>'
];

Which Parts of the Framework Are Now Deprecated?

Several components are marked for removal in CakePHP 4.0. The deprecation notices help you update your code ahead of the breaking changes.

TableRegistry Static Methods

Static methods like TableRegistry::config() and TableRegistry::clear() are deprecated. Use the instance methods on the TableRegistry object instead.

Network\Session

The entire Network\Session class is deprecated. Switch to using Cake\Http\Session.

Log\Log Static Methods

Static methods on Log\Log like Log::config() are deprecated. Use Log::setConfig() and other instance methods.

What Collection Utilities Were Added?

The Collection class gained new methods for more expressive data manipulation. These include unfold(), through(), and insert().

unfold() is handy for flattening a collection of arrays or iterators into a single sequence. through() allows you to pipe the collection through a callable, useful for creating custom chainable operations.

$items = $collection->unfold(function ($item) {
    return $item->children;
});
$result = $collection->through(function ($items) {
    return $items->filter($someFilter);
});

FAQ

Why was the hasMany('Through') association added?
It addresses a gap in modeling complex relationships where a join table holds extra data and you need a one-to-many connection. Before this, developers had to build workarounds using multiple associations or custom finders.

How do I migrate my custom FormHelper templates to 3.4?
You need to split your old monolithic template string into the new array structure. Check your templates for input, label, error, and formGroup parts and define them separately in the template array.

What should I use instead of TableRegistry::config()?
Get an instance of the TableRegistry first, then call instance methods. For example, use TableRegistry::getTableLocator()->config() instead of the static call.

Is the session deprecation going to break my existing code immediately?
No, it triggers deprecation warnings in your logs but continues to work in 3.4. You should plan to replace Network\Session with Cake\Http\Session before upgrading to CakePHP 4.x.

What's the practical use of the new Collection::through() method?
It lets you inject a custom transformation into a chain of collection methods. This is useful for debugging, logging intermediate results, or applying a reusable operation without breaking method chaining.

Releases In Branch 3.4

VersionRelease date
3.4.1420 May 2018
(8 years ago)
3.4.1316 Aug 2017
(8 years ago)
3.4.1201 Aug 2017
(9 years ago)
3.4.1118 Jul 2017
(9 years ago)
3.4.1009 Jul 2017
(9 years ago)
3.4.925 Jun 2017
(9 years ago)
3.4.819 Jun 2017
(9 years ago)
3.4.719 May 2017
(9 years ago)
3.4.602 May 2017
(9 years ago)
3.4.506 Apr 2017
(9 years ago)
3.4.428 Mar 2017
(9 years ago)
3.4.309 Mar 2017
(9 years ago)
3.4.222 Feb 2017
(9 years ago)
3.4.117 Feb 2017
(9 years ago)
3.4.012 Feb 2017
(9 years ago)
3.4.0-RC404 Feb 2017
(9 years ago)
3.4.0-RC322 Jan 2017
(9 years ago)
3.4.0-RC217 Jan 2017
(9 years ago)
3.4.0-RC114 Jan 2017
(9 years ago)
3.4.0-beta407 Jan 2017
(9 years ago)
3.4.0-beta301 Jan 2017
(9 years ago)
3.4.0-beta231 Dec 2016
(9 years ago)
3.4.0-beta130 Dec 2016
(9 years ago)