I have a HABTM connection between users and locations. Both models have a corresponding set of variables $hasAndBelongsToMany .
When I manage user locales, I want to remove the relationship between the user and the location, but not the location. Obviously, this location may belong to other users. I would expect the following code to only delete the connection table entry provided to the HABTM associations, but it deleted both entries.
$this->Weather->deleteAll(array('Weather.id' => $this->data['weather_ids'], false);
However, I'm new to CakePHP, so I'm sure something is missing. I tried to set the cascade to false and reorder the model using User, User-> Weather, Weather-> User. Bad luck.
Thanks in advance for your help.
source share