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.
@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!
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
Neither of them is deprecated. What is deprecated is
$connection->driver() //Deprecated, use getDriver() instead
and
$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”
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