Re: how to activate child afterDelete callbacks when i delete parent model?
On Jun 3, 1:26 pm, LunarDraco <mdc...@gmail.com> wrote:
>
> afterDelete may be too late and you might need to deal with this in
> the beforeDelete of the parent depending upon what info from the child
> you need to properly clean up the images.
To add to that, you'll likely need to know the ID of the parent model
in order to remove the correct records and files for the child model.
So pass the ID off to the other model. Something like:
function afterDelete()
{
$this->ChildModel->cleanupImages($this->id);
}
$this->id is set in Model::delete() before the record is removed. It's
then set to false after the afterDelete callback.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home