CakePHP 3.4.*-beta

Well the migration guide has
The following is a list of methods that are deprecated and replaced with getX and setX methods:

Which seem impossible as I can’t find any documentation on getX and setX methods. Furthermore with so much new stuff, where is the docs for CakePHP 3.4.*-beta?

And CakeDatabaseConnection is listed under Deprecations.

You mean not one person can attempt an answer?
Also the cakephp 3.3.* series was very user friendly, and easy. Why go changing stuff?

@jimgwhit, the CakePHP team (And the larger community who contribute to the framework development) are continuously striving to ensure that CakePHP remains a relevant framework that implements and follows any applicable standards or best practises.

In order to prevent code-rot and unused code lying around, sometimes it is required to deprecate (and later remove) certain code paths in favour of newer code paths. This is never done lightly, or “just because”. The getX and setX methods are an example of this. Having combined setter/getters has created massive headaches for everybody in the past. It is simpler and easier to use/maintain to split them. You mention that Cake\Database\Connection is listed, that is because the driver(), schemaCollection() and useSavePoints() methods have been deprecated and replaces with respective getX/setX methods (For example, driver() is now getDriver() and setDriver()). Explicit code is always better than trying to guess what’s happening.

CakePHP 3.4 is even more user friendly than 3.3. Almost everything you have used in 3.3 will carry on working (Deprecated does not mean removed). 3.4 is adding a number of important features, adopting PSR-7 probably being the most important!

The 3.4 docs are not available on the book site yet, but you can see the full migration guide, and the rest of the docs at

Thanks for reply but that is kind of what I meant without some sound documentation how would someone know to use getDriver().

There is sound documentation. The updated book is currently available at, the api docs have already been updated, and if you went to you’d see that it says the method is deprecated, and you should use setDriver() or getDriver() instead.

Got latest 3.4 beta installed. I searched whole project for any occurance of getDriver, could not find this any where, what gives? Also please answer this, is

use Cake\Datasource\ConnectionManager;   //deprecated

And / or is

$connection = ConnectionManager::get('default');  //deprecated?

Please yes or no, and if yes, what to change these line to.
Remember I am new to cakephp and have no way to know this stuff. I just got used of 3.3.*

Neither of them is deprecated. What is deprecated is

$connection->driver() //Deprecated, use getDriver() instead


$connection->driver($newDriverInstance) //Deprecated, use setDriver($newDriverInstance) instead

Remember, that “deprecated” does not mean it’s been removed, or no longer works. It simply means “that it is being replaced and will be removed in some future version, so start updating your code so long”

Right here:


In what situation would these even be used?
And thank you so much for your answer.

getDriver() would be used where you need to run methods on the background database driver (e.g. the Mysql driver class). Normally this would be for fairly advanced use-cases and probably 95% of all applications will never need to do this. One example from my own application is programmatically enabling/disabling auto identifier quoting:


setDriver() is an even more advanced usage where you need to programmatically change the driver of a specific connection instance. I cannot think of a use-case right now, but I’m sure that somebody has one :slight_smile:

Good to know, seems that what I use is good to go, that’s a relief. Thanks for the more detailed answer.