Difference between #6 and #7 of
Handling recursive deletion in Yii

Changes

Title unchanged

Handling recursive deletion in Yii

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

recursive, deletion, delete

Content changed

As a lead developer at [Mutable Labs](http://www.mutablelabs.com "Mutable Labs") II [www.jamesbarnsley.com](http://www.jamesbarnsley.com "www.jamesbarnsley.com") 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 ...
[...]
3 0
5 followers
Viewed: 16 310 times
Version: 1.1
Category: How-tos
Written by: JamesBarnsley
Last updated by: JamesBarnsley
Created on: Dec 19, 2012
Last updated: 8 years ago
Update Article

Revisions

View all history