Skip to main content

Posts

Showing posts with the label Softdelete behavior cakephp

Softdelete behaviors in cakephp

<?php class SoftDeleteBehavior extends ModelBehavior { /**  * Default settings  *  * @var array $default  */ public $default = array('deleted' => 'deleted_date'); /**  * Holds activity flags for models  *  * @var array $runtime  */ public $runtime = array(); /**  * Setup callback  *  * @param object $model  * @param array $settings  */     public function setup(&$model, $settings = array()) {         if (empty($settings)) {             $settings = $this->default;         } elseif (!is_array($settings)) {             $settings = array($settings);         }         $error = 'SoftDeleteBehavior::setup(): model ' . $model->alias . ' has no field ';         $fields = $this->_normalizeFields($model, $settings)...