Welcome Guest, Not a member yet? Register   Sign In
"soft" delete
#5

[eluser]WanWizard[/eluser]
I capture this scenario in my models. In the delete() method I check if the table contains a 'deleted' column. If so, I run an UPDATE instead of a DELETE query.

The controller is not aware of this, it just calls the delete() method of the model. The opposite happens at retrieval, where a WHERE clause is inserted with 'AND deleted = 0' to filter out deleted records.


Messages In This Thread
"soft" delete - by El Forum - 07-01-2011, 03:18 AM
"soft" delete - by El Forum - 07-01-2011, 04:04 AM
"soft" delete - by El Forum - 07-01-2011, 04:10 AM
"soft" delete - by El Forum - 07-02-2011, 12:38 PM
"soft" delete - by El Forum - 07-02-2011, 01:55 PM
"soft" delete - by El Forum - 06-18-2013, 11:25 PM
"soft" delete - by El Forum - 06-19-2013, 12:59 AM
"soft" delete - by El Forum - 06-19-2013, 02:59 AM
"soft" delete - by El Forum - 06-19-2013, 04:20 AM
"soft" delete - by El Forum - 06-19-2013, 04:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB