Cake handles the join table naming convention based off the tables
used, rename your join table to customers_scheduler_services

On Oct 17, 8:22 am, MDB <[EMAIL PROTECTED]> wrote:
> Being new to cake (became the owner of 2 cakephp applications), I dont
> think I am getting something simple.  First, I have three tables,
> customers (PK ID int), services (PK ID int) and then
> customers_services (customer_id int, service_id int).  I then have the
> 2 models below.  I am in the process of moving this application over
> to another DB and I have to change the tables names  so, I first
> changed the services table to scheduler_services and then in the
> service model I changed it to use the correct table name (var
> $useTable = 'scheduler_services').  Once I did this, I am now getting
> this error:
>
> Missing Database Table
> Error: Database table customers_scheduler_services for model
> CustomersSchedulerService was not found.
>
> I am guessing it has something to do with the table join however can
> not figure it out.  I changed other table names without a problem
> however this is the only one that has a join to it.
>
> Service Model
>
> class Service extends AppModel
> {
>         var $name = 'Service';
>         var $useTable = 'scheduler_services';
>
>         var $hasAndBelongsToMany = array(
>                 'Customer' => array(
>                         'className' => 'Customer',
>                         'joinTable' => 'customers_services',
>                         'foreignKey' => 'service_id',
>                         'associatedForeignKey' => 'customer_id'
>                 )
>         );
>
> }
>
> Customer Model
>
> class Customer extends AppModel
> {
>         var $name = 'Customer';
>         var $actsAs = array('SoftDeletable');
>
>         var $hasAndBelongsToMany = array(
>                 'Service' => array(
>                         'className' => 'Service',
>                         /*
>                         'joinTable' => 'customers_services',
>                         'foreignKey' => 'customer_id',
>                         'associatedForeignKey' => 'service_id',
>                         */
>                         'joinTable' => null,
>                         'foreignKey' => null,
>                         'associatedForeignKey' => null,
>                         'conditions' => null,
>                         'fields' => null,
>                         'order' => null,
>                         'limit' => null,
>                         'uniq' => true,
>                         'offset' => null,
>                         'fnderQuery' => null,
>                         'deleteQuery' => null,
>                         'insertQuery' => null
>                 )
>         );
>
> }
>
> If anyone can help I would greatly appreciate it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to