qqq
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user