From 4a49c140551ed8c619159f7f46825e73d3df2b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Feb 2021 18:22:52 +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/Base/BaseActiveRecord.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index d83b61ed..9bdfa0e7 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -417,8 +417,6 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess $trance->commit(); $lastId = $this->setPrimary($lastId, $param); - var_dump($lastId); - $this->event->dispatch(self::AFTER_SAVE, [$attributes, $param]); } catch (\Throwable $exception) { $trance->rollback(); @@ -497,6 +495,10 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess return false; } + if (!$this->event->dispatch(self::BEFORE_SAVE, [$this])) { + return false; + } + static::getDb()->enablingTransactions(); [$attributes, $condition, $param] = $this->filtration_and_separation(); if (($primary = $this->getPrimary()) !== null) {