CakePHP 3 - ConnectionManager::config and persisting connection configuration.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

CakePHP 3 - ConnectionManager::config and persisting connection configuration.

Luuk Honings

I have a need to, in addition to the default DB connection (from app.php) , add another DB connection specific to the client. Ie every client ends up with 2 connections and depending on where data needs to be retrieved from, the app sets the defaultConnectionName() in the relevant Table object. 

I am currently loading the 2nd connection info based on the logged in user, on the fly, using ConnectionManager::config(). This works well. However what I've noticed is that the app loads the connection info every time the user makes a request. Would there be a way to persist this connection information between requests, short of storing connection info in Session? Having said that I did also notice that bootstrap gets called for every request - loading the 'default' connection information anyway.


Sign up for our Newsletter for updates.
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
Like Us on FaceBook
Follow us on Twitter
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit