qqq
This commit is contained in:
@@ -196,13 +196,15 @@ class Model extends Base\Model
|
||||
*/
|
||||
public function delete(): bool
|
||||
{
|
||||
if ($this->beforeDelete()) {
|
||||
$result = static::deleteByCondition($this->_attributes, $this->_attributes);
|
||||
|
||||
return $this->afterDelete($result);
|
||||
} else {
|
||||
if (!$this->beforeDelete()) {
|
||||
return false;
|
||||
}
|
||||
if ($this->hasPrimary()) {
|
||||
$result = static::deleteByCondition("id = :id", [":id" => $this->getPrimaryValue()]);
|
||||
} else {
|
||||
$result = static::deleteByCondition($this->_attributes);
|
||||
}
|
||||
return $this->afterDelete($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -731,7 +731,7 @@ trait QueryTrait
|
||||
if ($params === null) {
|
||||
return $this;
|
||||
}
|
||||
$this->attributes = $params;
|
||||
$this->attributes = array_merge($this->attributes, $params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user