How to do multi database


#1

Hello everyone, I have a very big doubt and I hope you help me.

I have an application in PHP with no framework. And in this I use a multi-database schema, it works like this:

I have three companies that use the same system, each using its own database, and a base on which all three share. So when logging in, using the shared database, I create the session and inform it of its base, and from there, the user accesses only the data from their respective database.

Well the system has grown, I have an average of 230 clients and I am facing problems with migration, internationalization (the first customer abroad) and so on. So for ease of coding I’m switching the system to CakePHP. But regarding the connection I am having difficulties in making use of the ACL and this one is in the shared base.

Does anyone have a light?

Thanks in advance.

PS: Sorry my English, I’m using Google Translate


#3

In your Model/Table your might want to set something like:

  $this->table($this->connection()->config()['database'].'.users');

if you query two different databases at the same time