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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Deleting items and their children if they belongTo
I'm luvin cakephp at the moment, in particular how fast things get done, and all the hidden functionality that automagically "happens". I was wondering if there is a simple way to do the following: 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? Thanks for any pointers! Taff --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---