Cakephp 4 - Multitenant management

Hi,
I would like to implement a Saas App with Cake but I would like to understand if with version 4 it’s possible to manage a multi-database connection directly into the code.

I want to switch database connection after user login from a login.

I’ve found some tutorials for the past versions but I cannot find documentation about the methods in the Cakephp newest version.

Does someone have ideas or suggestions about this topic?

Thanks,
G.

Does this help?

I will try it… :+1:

Thanks.

Sorry… I have another question.

But if I need to connect to a database created on-fly with a script e get the name from a central db, how can I use defaultConnectionName()?

For instance, I create a central database with all users (username, password and db_name), on creation I create the database structure with a script. When a user login in the main up I connect all application to db_name.

Do you think that it’s possible?

Best regards,
G.

Sounds like you also need to create a connection at runtime.