From 0456a155c847d5339e99af087e69cc667616d1dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 17 Dec 2020 14:17:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/ActiveRecord.php | 4 ++-- Database/Base/BaseActiveRecord.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index 62e63c61..5a97130d 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -234,9 +234,9 @@ class ActiveRecord extends BaseActiveRecord $primary = $this->getPrimary(); if (!empty($primary)) { - $sul = static::deleteAll([$primary => $this->getAttribute($primary)]); + $sul = static::deleteByCondition([$primary => $this->getAttribute($primary)]); } else { - $sul = static::deleteAll($conditions); + $sul = static::deleteByCondition($conditions); } if (!$sul) { return false; diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 8cfe2f3b..8d4caf96 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -171,7 +171,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess * @return null|string * @throws Exception */ - public function getPrimary() + public function getPrimary(): ?string { if (!$this->hasPrimary()) { return null; @@ -253,7 +253,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess * @return bool * @throws Exception */ - public static function delete($condition = NULL, $attributes = [], $if_condition_is_null = false): bool + public static function deleteByCondition($condition = NULL, $attributes = [], $if_condition_is_null = false): bool { if (empty($condition)) { if (!$if_condition_is_null) {