From 149cf7165f4d7c6c6ef691a861ed394a2d848102 Mon Sep 17 00:00:00 2001 From: Arif Hoque Date: Wed, 11 Mar 2026 17:01:33 +0600 Subject: [PATCH] Add proper error message if creatable attribute not defined in model --- .../Entity/Query/InteractsWithModelQueryProcessing.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php b/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php index 0c532b0..2eaef44 100644 --- a/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php +++ b/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php @@ -422,6 +422,12 @@ public static function createFromModel(Model $model): static */ protected function getCreatableAttributes(): array { + if (empty($this->creatable)) { + throw new \RuntimeException( + "Model " . static::class . " has no \$creatable attributes defined." + ); + } + $creatableAttributes = []; foreach ($this->creatable as $attribute) { if (isset($this->attributes[$attribute])) {