I know I'm not the first to notice this, but I can't find a solution
--

My HABTM works fine if there's at least one relationship.  In these
cases, Cake deletes everything from the interstitial table and inserts
the specified relationships.

However, if there are NO relationships, Cake never does the delete.
It SHOULD delete everything from the interstitial, then do no
inserts.  But if I have one relationship, and try to remove it, it
doesn't get removed because the delete doesn't happen.

So you effectively can't go from SOME relationships to NO
relationships.

Out of sight, out of mind?  Cake seems to be saying, "Hey, if you
don't bring up the relationships, I'm just going to let this be..."

My solution is, in my controller, to check if the incoming data array
is missing the relationship data (which it would be if no checkboxes
were selected), and then populate it with an empty array.

Another solution I can envision is using a beforeSave filter on the
model to ALWAYS delete everything from the interstitial when the
record is saved.  This would result in the double delete in some
cases, but that's not a huge deal.

Any solutions to this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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