Typically, all databases are Data Source in app.php defined.
The Connection Manager can change the database as needed.
I have read some similar post but this one is somehow extra…
My problem is that :
I have to have two databases:
- database for authentication
- database for after logged in users.
The app.php has a database defaultConfiguration, pointing to the first database from which the user authenticates. Thereafter, however, all requests are intended to refer to a second database, the database name is read during authentication. So far I’ve tried:
Connection Manager :: config ( ‘customer’, [
‘ClassName’ => ‘Cake \ Database \ Connection’,
‘Driver’ => ‘Cake \ Database \ Driver \ mysql’,
‘Persistent’ => false,
‘Host’ => ‘localhost’,
‘Username’ => ‘’,
‘Password’ => ‘’,
‘Database’ => $ this-> user-> group-> db_name,
‘Encoding’ => ‘utf8’
‘Timezone’ => ‘UTC’
‘CacheMetadata’ => true,
And I read the database connection with Connection Manager :: get ( ‘customer’); But in the models, this connection is not found. What causes errors.
Can I control cakephp 3, from a certain point to let all other requests to run a persistent database instead of always looking for a Datasourse in app.php?
For any advice, I would be very happy …