I have a users
table with a reference to tenant_id
and manager_id
(these are my aliases for the users
model). When I try to bake the model, I get the following error:
Error: Missing database table 'tenants' for model 'Tenant'
I thought bake would allow me to tell it what my aliases are. Am I doing something wrong, or do I just have to manually create my models and forego baking?
The magic of Cake is, I think, being clever and saying, "According to CakePHP convention, tenant_id
points to Tenant.id
and manager_id
points to Manager.id
, but I can't find those tables."
I would be inclined to code the model myself - I rarely use bake except when I'm laying down a project and things aren't too complex.
It's not clear to me what you are trying to achieve here. Does tenant_id
mirror User.id
? If you are trying to do what I think you are, then you'll need to create three Models - User, Tenant and Manager and code something like:
(models/tenant.php)
class Tenant extends AppModel {
var $useTable = 'users'; // This model uses the 'users' database table.
}