Skip to content

Commit 8cb5729

Browse files
committed
refactor: Apply suggestions (revert)
1 parent e3826f8 commit 8cb5729

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

system/BaseModel.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ abstract class BaseModel
212212
protected bool $updateOnlyChanged = true;
213213

214214
/**
215-
* Rules used to validate data
216-
* in $this->insert(), $this->update(), $this->save() methods.
215+
* Rules used to validate data in insert(), update(), save(),
216+
* insertBatch(), and updateBatch() methods.
217217
*
218218
* The array must match the format of data passed to the `Validation`
219219
* library.
@@ -973,8 +973,7 @@ public function update($id = null, $row = null): bool
973973
throw new InvalidArgumentException('update(): argument #1 ($id) should not be boolean.');
974974
}
975975

976-
// if (is_numeric($id) || is_string($id)) {
977-
if (! in_array($id, [null, 0, '0'], true) && (is_numeric($id) || is_string($id))) {
976+
if (is_numeric($id) || is_string($id)) {
978977
$id = [$id];
979978
}
980979

@@ -1105,7 +1104,7 @@ public function delete($id = null, bool $purge = false)
11051104
throw new InvalidArgumentException('delete(): argument #1 ($id) should not be boolean.');
11061105
}
11071106

1108-
if (! in_array($id, [null, 0, '0'], true) && (is_numeric($id) || is_string($id))) {
1107+
if (is_numeric($id) || is_string($id)) {
11091108
$id = [$id];
11101109
}
11111110

system/Model.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@ public function countAllResults(bool $reset = true, bool $test = false)
506506
$this->builder()->where($this->table . '.' . $this->deletedField, null);
507507
}
508508

509+
// When $reset === false, the $tempUseSoftDeletes will be
510+
// dependent on $useSoftDeletes value because we don't
511+
// want to add the same "where" condition for the second time.
509512
$this->tempUseSoftDeletes = $reset
510513
? $this->useSoftDeletes
511514
: ($this->useSoftDeletes ? false : $this->useSoftDeletes);

0 commit comments

Comments
 (0)