Hello all, I am having a heck of a time trying to understand how to
setup table joins. First I have the following 3 tables:
scheduler_customers
Primary Key = id
tenant_service_approved
Primary Key = tenant_service_approved_id
scheduler_customers_tenant_service_approved
Columns: scheduler_customer_id,
tenant_service_approved_tenant_service_approved_id
I then have a service model, (it is name service because the table was
named services however, there was already a table named
tenant_service_approved that already had all of the data) that looks
something like this:
class Service extends AppModel
{
var $name = 'Service';
var $useTable = 'tenant_service_approved';
var $primaryKey = 'tenant_service_approved_id';
var $hasAndBelongsToMany = array(
'Customer' => array(
'className' => 'Customer',
'joinTable' =>
'scheduler_customers_tenant_service_approved',
'foreignKey' => 'service_id',
'associatedForeignKey' => 'customer_id'
)
);
}
So my quesetion is do I have the column names set up correctly in the
scheduler_customers_tenant_service_approved table and then what is the
proper way to set up the hasAndBelongsToMany? I have tried changing
the names over and over however nothing seems to work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---