Monday, April 4, 2016

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

Hi,

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.

Cheerio,
Luuk

--
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup
 
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 https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
---
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 cake-php+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: