0
updateAll()에서 beforeSave() 및 afterSave() 콜백을 트리거해야합니다. 업데이트 ID 필드가 필요하기 때문에 updateAll()을 사용합니다. (편집 가능한 ID에 대해 '잘못'알고 있었지만 사용 된이 데이터베이스는 이미 지저분합니다.)FIRE before update onAll
내가해야 할 일은 saveA()와 마찬가지로 updateAll()이 beforeSave() 및 afterSave()를 실행하도록 트리거하는 것입니다. 여기
1.3function updateAll($fields, $conditions = true) {
$args = func_get_args();
$output = call_user_func_array(array('parent', 'updateAll'), $args);
if ($output) {
$created = false;
$options = array();
$this->Behaviors->trigger($this, 'afterSave', array(
$created,
$options,
));
$this->afterSave($created);
$this->_clearCache();
return true;
}
return false;
}
다음이 내가 CakePHP를 조정하는 코드입니다 CakePHP의에서 updateAll()의 해킹 2.3
function updateAll($fields, $conditions = true) {
$args = func_get_args();
$output = call_user_func_array(array('parent', 'updateAll'), $args);
if ($output) {
$created = false;
$options = array();
$event = new CakeEvent('Model.afterSave', $this, array($created, $options));
$this->getEventManager()->dispatch($event);
$this->afterSave($created);
$this->_clearCache();
return true;
}
return false;
}
나는를 BeforeSave를 (전화 싶다면 어떤 문제가
,)에서 updateAll?