This commit is contained in:
Jephté Clain 2025-04-30 06:51:49 +04:00
parent a371a68ee2
commit aabdb3f765

View File

@ -677,7 +677,7 @@ abstract class CapacitorStorage {
function _delete(CapacitorChannel $channel, $filter, $func, ?array $args): int {
$this->_create($channel);
if ($func === null) $func = CapacitorChannel::onDelete;
$onEach = func::with($func)->bind($channel);
$onDelete = func::with($func)->bind($channel);
$db = $this->db();
# si on est déjà dans une transaction, désactiver la gestion des transactions
$manageTransactions = $channel->isManageTransactions() && !$db->inTransaction();
@ -693,8 +693,8 @@ abstract class CapacitorStorage {
$all = $this->_allCached("delete", $channel, $filter);
foreach ($all as $values) {
$rowIds = $this->getRowIds($channel, $values);
$delete = boolval($onEach->invoke([$values["item"], $values, ...$args]));
if ($delete) {
$shouldDelete = boolval($onDelete->invoke([$values["item"], $values, ...$args]));
if ($shouldDelete) {
$db->exec([
"delete",
"from" => $tableName,