Does anyone know an alternative to SoftDeletable Behavior that is compatible with Cake 1.3.x
If there is no ready-made behavior, any suggestions on how I do this in the last cake?
Found out a quick hack. First of all, if your table represents a tinyint (1) unsigned field named remote , which defaults to 0 .
In app / app_model.php add the following function:
function softDelete( $id ) { if( $id && $this->hasField( 'deleted' ) ) { $this->id = $id; return $this->saveField( 'deleted', 1 ); } return false; }
and then from your controller method (which does the deletion),
$this->Model->softDelete( $id );
Catch - wherever you execute find () , you need to specify the deleted! = 1 condition.
Still trying to figure out how to implement this in the same way as SoftDeletable behavior.
source share