/** * ユーザの削除 * * @param Model $model ビヘイビア呼び出し元モデル * @param array $data data * @return mixed On success Model::$data, false on failure * @throws InternalErrorException */ public function deleteUser(Model $model, $data) { //トランザクションBegin $model->begin(); $model->prepare(); try { //Userデータの削除->論理削除 $user = $model->create(array('id' => $data['User']['id'], 'handlename' => $data['User']['handlename'], 'is_deleted' => true)); if (!$model->save($user, false)) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } //関連DBの削除 $model->deleteUserAssociations($user['User']['id']); //トランザクションCommit $model->commit(); } catch (Exception $ex) { //トランザクションRollback $model->rollback($ex); } return true; }