diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index 0adfcdf..d1c78fc 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -467,24 +467,18 @@ class CRUDComponent extends Component if (!empty($params['contain'])) { $data->contain($params['contain']); } + $data = $data->first(); if (isset($params['beforeSave'])) { $data = $params['beforeSave']($data); - if ($data === false) { - $skipExecution = true; - $success = false; - } } - if (!$skipExecution) { - $data = $data->first(); - if (!empty($data)) { - $success = $this->Table->delete($data); - $success = true; - } else { - $success = false; - } - if ($success) { - $bulkSuccesses++; - } + if (!empty($data)) { + $success = $this->Table->delete($data); + $success = true; + } else { + $success = false; + } + if ($success) { + $bulkSuccesses++; } } $message = $this->getMessageBasedOnResult(