Hello, I’m using a structure just like yours.
Inside the Controller in the beforeFilter Event I put the schema.table name like that.
CadastrosController extends AppController
{
public function beforeFilter(Event $event)
{
$session = $this->request->session();
$empresa = $session->read('Empresa');
if (isset($empresa->schemaname)){
$this->Cadastros->table($empresa->schemaname.'.cadastros');
}
....
My difficulty is when I create a new registry and it is necessary to create a new schema.
What is your vision when we have many registrations and many schemas … will it become a problem in the future?
Anyone else have any ideas about this?
This post is interesting, but with multiple databases mysql.