Nasty problem: I have model Event and model Post, and both are
associated with model Comment through a hasMany association. I've also
set dependent = true:
var $hasMany = array(
'Comment' => array(
'foreignKey' => 'parent_id',
'conditions' => "Comment.parent_type = 'event'",
'order' => "Comment.id ASC",
'dependent' => true
);
Now, when I delete Event with id 28, all comments with parent_id 28
will be deleted, also the ones that belong to Post.
I guess I know why this happens (dependent only uses the parent_id to
determine the comments to be deleted, not the extra conditions), but
might there be a way of dealing with this other than defining a
comments model for every other model that needs it?
Thanks,
Jeroen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment