I finally figured it out. I changed the table name
(scheduler_customers_sheduler_services) but I didn't change the column
names to scheduler_customer_id and scheduler_service_id. Once I did
that it started working again. Thanks again for your help.
On Oct 17, 10:00 am, MDB <[EMAIL PROTECTED]> wrote:
> Okay, here is what I have now and I am no longer getting any error but
> the services for the cusomer are no longer showing.
>
> table customers is now scheduler_customers
> table services is now scheduler_customers
> table customers_services is now scheduler_customers_sheduler_services.
>
> My customer model now looks something like this:
>
> class Customer extends AppModel
> {
> var $name = 'Customer';
> var $useTable = 'scheduler_customers';
>
> 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
> )
> );
>
> }
>
> and my service model looks like this:
>
> class Service extends AppModel
> {
> var $name = 'Service';
> var $useTable = 'scheduler_services';
>
> var $hasAndBelongsToMany = array(
> 'Customer' => array(
> 'className' => 'Customer',
> 'joinTable' =>
> 'scheduler_customers_scheduler_services',
> 'foreignKey' => 'service_id',
> 'associatedForeignKey' => 'customer_id'
> )
> );
>
> }
>
> Once again, in short, I changed the table names and set the useTable
> and now the services no longer show. Not real sure what else I should
> look for?
>
> On Oct 17, 9:28 am, MDB <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thank you, that fixed the error however now the services are not
> > showing for the customer. Is there something else that I am missing?
>
> > On Oct 17, 9:14 am, scs <[EMAIL PROTECTED]> wrote:
>
> > > 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.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- 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 [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
-~----------~----~----~----~------~----~------~--~---