Monday, July 27, 2009

Re: Deleting items and their children if they belongTo

Hi,

> I have baked a few controllers, models and views, but if I delete an
> item using threads/delete/3 is there an easy way of deleting all the
> posts (with an thread_id of 3) that "belongTo" the thread with an id
> of 3, which I have defined as "hasMany" posts, or do I need to do it
> manually?

Yes:
http://book.cakephp.org/view/78/Associations-Linking-Models-Together#hasMany-82
- see dependent attribute
http://book.cakephp.org/view/516/Deleting-Data#del-690


Regards,
Piotr

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