> What is the Cake way of deleting all the prefences for a User (but not
> the User itself) without having to loop over all the users prefences
> and call DELETE on the Preference model?

Look in the API at the model class. Specifically, checkout the del
method, and the _deleteHasMany method. There is a lot of stuff in the
API that you won't find anywhere else!

_deleteHasMany will loop through the preferences and delete each one.
This would be the recommended way of deleting preferences since it
would be done by the model.

Of course the other way would be:
$this->Preference->execute("DELETE FROM preferences WHERE user.id =
".$user_id);

But, if you have a "beforeDelete" method defined for the preference
model, the execute sql method would skip that logic.

sc


--~--~---------~--~----~------------~-------~--~----~
 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