Monday, October 27, 2008

Deleting Associations in HABTM possible without HABTM-Behaviour???

Hello! I'm testing the CakePHP 1.2 RC3. I tried to delete a HABTM-
Association.
It only works if I have defined the $hasAndBelongsToMany in one of the
two models. As soon as I have defined it in both the delete-statement
is wrong :(

Until now I used the HABTM Add&Delete Behaviour from the bakery for
this. But isn't it possible in RC3 by Cake itself?

I have 3 tables:
customers
cities
cities_customers

If I start the admin_del-function it creates...

DELETE FROM `cities_customers` WHERE `cities_customers`.`city_id` = 1

But that should be...
DELETE FROM `cities_customers` WHERE `cities_customers`.`customer_id`
= 1


You can find the code of the models in the cakebin:
http://bin.cakephp.org/view/506261235

--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: