I’m looking for a way to access the database object CakePHP uses to make its calls to the database.
I have a class I wrote outside of CakePHP that uses the database. Instead of opening its own connection, I thought it would be nice to just use one that may already be open.
I have CakePHP set up to use MySQLi and the class I built uses MySQLi as well.
you can use DboSource Class for accessing Database and making database calls.
DboSource Class API doc
getConnectionGet the underlying connection object.