Is it feasible for several models to stay in one database along with other models in another (utilizing the same connection)?

I have many read-only tables which i want shared between multiple installations of my system. Other tables have to be per-installation. With regard to example, let us say users may be the shared table, and posts is per-installation.

In a single schema (let us refer to it as "shared") we've the users table, as well as in another schema ("mycake") is posts.

I have been capable of getting the consumer model reading through in the other database by developing a new database connection which indicates the shared database (although the two databases are on a single host and therefore are both accessible with similar login particulars).

class User extends AppModel {
    var $useDBConfig = 'sharedConnection';

The issue is when the time comes to become listed on towards the posts table. It does not prepend the schema title towards the table title, so it aren't able to find posts.

// what it does
SELECT * FROM users User INNER JOIN posts Post ...

// what I'd like it to do:
SELECT * FROM shared.users User INNER JOIN mycake.posts Post ...

So essentially, it is possible to method to assign a highly skilled table title to some model and pressure it to make use of that in most its queries? Setting var $useTable = 'shared.users'; does not help...

There is a solution available here:

This site has a method to get it done, but it is just a little hacky

I have built a website in CakePHP which has models using different databases and that i didn't have trouble with joins across different databases - the framework appeared to consider proper care of everything for me personally. Though you will need to clearly condition the database tables utilized in your models to have it to operate.