Re: Table Join Problem Again

2008-10-20 Thread MDB

Thanks, I will try that out.


On Oct 20, 2:03 pm, "soldier.coder" <[EMAIL PROTECTED]>
wrote:
> Short answer is no, you do not.
>
> EVERY table in cake must have primary key "id" which is autonumber
> int.
>
> When you refer to the primary key of another table, it is that
> tablename + "_id".
>
> On Oct 20, 11:31 am, MDB <[EMAIL PROTECTED]> wrote:
>
>
>
> > 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.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Table Join Problem Again

2008-10-20 Thread soldier.coder

Short answer is no, you do not.

EVERY table in cake must have primary key "id" which is autonumber
int.

When you refer to the primary key of another table, it is that
tablename + "_id".



On Oct 20, 11:31 am, MDB <[EMAIL PROTECTED]> wrote:
> 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 cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Table Join Problem Again

2008-10-20 Thread MDB

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 cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---