Revision #6 has been created by JamesBarnsley on Dec 23, 2012, 1:56:10 PM with the memo:
Just updated link to my website, thought I may aswell make it a link
« previous (#5) next (#7) »
Handling recursive deletion in Yii
recursive, deletion, delete
As a lead developer at
Mutable Labs I was tasked to find a way to do recursive deletion in Yii. As I asked other developers and looked around the internet the usual answers all came up, use a plugin or use cascade delete at the DB level, but I did not want to do either of these.
So I came up with my own solution which I found to be simple and effective. It all starts off by adding a function to your global model, if you do not have one of these then create one. Create a model that extends active record and then make sure your other models extend the global model. This creates a nice place to put global model functions which can be used by any model in your application.
Add this function to the global model ...