I'll try to write my very first behavior that does a soft delete instead of 
a hard delete. I've expanded my model with

public $actsAs = array('SoftDelete');


and I've created the behavior "SoftDeleteBehavior.php" in 
App/Model/Behavior:

 

> <?php
> App::uses('ModelBehavior', 'Model');
> class SoftDeleteBehavior extends ModelBehavior
> {
>     function setup(Model $Model, $settings = array())
>     {
>         
>     }
>     
>     function delete(Model $Model, $id = null)
>     {
>         $Model->id = $id;
>         
>         if ($Model->saveField('deleted', date('Y-m-d H:i:s'))) {
>             return true;
>         }
>         return false;
>     }
> }


However, when I try to delete something, the delete() method from my 
behavior doesn't overwrite the normal one. What could cause this issue?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to