user198003
user198003

Reputation: 11151

update instead of delete

with cakephp, is it possible to have update sql action instead of delete (i would like to set some kind of flag, so it "looks" like it is deleted)?

tnx in adv!!!

Upvotes: 4

Views: 467

Answers (2)

openprojdevel
openprojdevel

Reputation: 182

Just create an delete / disable kind of column and update the same on delete, you would need to put condition delete / disable true for all find queries

Upvotes: 0

Rob Wilkerson
Rob Wilkerson

Reputation: 41236

It's easy enough using callbacks. A less manual approach, though, would be to grab the SoftDeletable behavior and tweak it to meet any special needs you may have.

Upvotes: 5

Related Questions