From 1759cc66960f8c7ebf5ae7ca0c03c22118c0b0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 25 Feb 2021 18:28:02 +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 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index 4c8485e8..693c6571 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -206,17 +206,9 @@ class ActiveRecord extends BaseActiveRecord $primary = $this->getPrimary(); if (!empty($primary)) { - $sul = static::deleteByCondition([$primary => $this->getAttribute($primary)]); - } else { - $sul = static::deleteByCondition($conditions); + $conditions = [$primary => $this->getAttribute($primary)]; } - if (!$sul) { - return false; - } - if (method_exists($this, 'afterDelete')) { - $this->afterDelete(); - } - return true; + return static::deleteByCondition($conditions); }