From d0258ccd5e485ad411aa2ea7da9a3def8025c360 Mon Sep 17 00:00:00 2001 From: Muhammad Ridzuan Date: Wed, 4 Dec 2024 17:21:25 +0800 Subject: [PATCH] Replace `!Entity::has()` with `Entity::isEmpty()` - Fix issue where fields with null values triggered errors in buildRules. - Refer: https://github.com/CakeDC/Enum/issues/63 --- src/Model/Behavior/EnumBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Behavior/EnumBehavior.php b/src/Model/Behavior/EnumBehavior.php index f1d2bb5..76e8481 100644 --- a/src/Model/Behavior/EnumBehavior.php +++ b/src/Model/Behavior/EnumBehavior.php @@ -292,7 +292,7 @@ public function __call(string $method, array $args): bool throw new MissingEnumConfigurationException([$alias]); } - if (!$entity->has($config['field']) && Hash::get($config, 'allowEmpty') === true) { + if ($entity->isEmpty($config['field']) && Hash::get($config, 'allowEmpty') === true) { return true; }