From 7a8b48bee257c4bcfdddcd23eb4493ec12f0202b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=81=92?= <2390904403@qq.com> Date: Wed, 22 Jul 2026 11:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E5=8F=AA?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E5=B1=82=E6=97=B6=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Entity.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Entity.php b/src/Entity.php index a6005aab..68ee8bdc 100644 --- a/src/Entity.php +++ b/src/Entity.php @@ -50,7 +50,11 @@ public function __construct(?Model $model = null) $options = array_merge($baseOptions, $options); if (is_null($model)) { - $class = !empty($options['modelClass']) ? $options['modelClass'] : str_replace('\\entity\\', '\\model\\', static::class); + if (empty($options['modelClass'])) { + $class = str_replace(['\\entity\\', 'entity\\'], ['\\model\\', 'model\\'], static::class); + } else { + $class = $options['modelClass']; + } $model = new $class(); }