I have a model Recipe that has a one to many relationship with a model
IngredientList
I want to delete a single recipe from the Recipe model which should
also delete all the records from the IngredientList model that have
the recipe's ID.
I would have thought that there would be a single line command like
there is for insert.
if ($this->Recipe->saveAll($this->data))
But this is only way I could find to do it:
function delete($id)
{
$this->IngredientList->deleteAll("IngredientList.recipe_id =
$id",
true);
$this->Recipe->del($id);
$this->flash('The recipe with id: '.$id.' has been deleted.', '/
recipes');
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---