Model/Behavior/SoftDeleteBehavior.php
public function delete($model, $id) {
		$runtime = $this->runtime[$model->alias];

		$data = array();
		$fields = $this->_normalizeFields($model);
		foreach ($fields as $flag => $date) {
			if (true === $runtime || $flag === $runtime) {
				$data[$flag] = true;
				if ($date) {
					$data[$date] = date('Y-m-d H:i:s');
				}
				if ($flag === $runtime) {
					break;
				}
			}
		}

		$record = $model->find('first', array(
			'fields' => $model->primaryKey,
			'conditions' => array($model->primaryKey => $id),
			'recursive' => -1
		));

		if (!empty($record)) {
			$model->set($model->primaryKey, $id);
			unset($model->data[$model->alias]['modified']);
			unset($model->data[$model->alias]['updated']);
			return $model->save(array($model->alias => $data), false, array_keys($data));
		}

		return true;
	}
public function delete($model, $id) {
		$runtime = $this->runtime[$model->alias];

		$data = array();
		$fields = $this->_normalizeFields($model);
		foreach ($fields as $flag => $date) {
			if (true === $runtime || $flag === $runtime) {
				$data[$flag] = true;
				if ($date) {
					$data[$date] = date('Y-m-d H:i:s');
				}
				if ($flag === $runtime) {
					break;
				}
			}
		}

		$record = $model->find('first', array(
			'fields' => $model->primaryKey,
			'conditions' => array($model->primaryKey => $id),
			'recursive' => -1
		));

		if (!empty($record)) {
			$model->set($model->primaryKey, $id);
			unset($model->data[$model->alias]['modified']);
			unset($model->data[$model->alias]['updated']);
			return $model->save(array($model->alias => $data), false, array_keys($data));
		}

		return true;
	}
public function delete ( $ model , $ id ) { $ runtime = $ this -> runtime [ $ model -> alias ] ; $ data = array ( ) ; $ fields = $ this -> _normalizeFields ( $ model ) ; foreach ( $ fields as $ flag => $ date ) { if ( true === $ runtime || $ flag === $ runtime ) { $ data [ $ flag ] = true ; if ( $ date ) { $ data [ $ date ] = date ( 'Y-m-d H:i:s' ) ; } if ( $ flag === $ runtime ) { break ; } } } $ record = $ model -> find ( 'first' , array ( 'fields' => $ model -> primaryKey , 'conditions' => array ( $ model -> primaryKey => $ id ) , 'recursive' => - 1 ) ) ; if ( ! empty ( $ record ) ) { $ model -> set ( $ model -> primaryKey , $ id ) ; unset ( $ model -> data [ $ model -> alias ] [ 'modified' ] ) ; unset ( $ model -> data [ $ model -> alias ] [ 'updated' ] ) ; return $ model -> save ( array ( $ model -> alias => $ data ) , false , array_keys ( $ data ) ) ; } return true ; }
Mark record as deleted

@param object $model
@param integer $id
@return boolean
Mark record as deleted