This commit is contained in:
xl
2023-07-10 11:28:53 +08:00
parent 203eda17ad
commit 9d7605b8e4
2 changed files with 308 additions and 306 deletions
+7 -5
View File
@@ -196,13 +196,15 @@ class Model extends Base\Model
*/ */
public function delete(): bool public function delete(): bool
{ {
if ($this->beforeDelete()) { if (!$this->beforeDelete()) {
$result = static::deleteByCondition($this->_attributes, $this->_attributes);
return $this->afterDelete($result);
} else {
return false; return false;
} }
if ($this->hasPrimary()) {
$result = static::deleteByCondition("id = :id", [":id" => $this->getPrimaryValue()]);
} else {
$result = static::deleteByCondition($this->_attributes);
}
return $this->afterDelete($result);
} }
+1 -1
View File
@@ -731,7 +731,7 @@ trait QueryTrait
if ($params === null) { if ($params === null) {
return $this; return $this;
} }
$this->attributes = $params; $this->attributes = array_merge($this->attributes, $params);
return $this; return $this;
} }