From a8ff5d47f8f4a91a1fae01519e8ec4952cc7db1f Mon Sep 17 00:00:00 2001 From: kaihoefler <26207541+kaihoefler@users.noreply.github.com> Date: Sun, 24 Mar 2024 10:35:25 +0100 Subject: [PATCH] Fixing Issue with $constant beeing of type /Cake/ORM/Entity --- src/Model/Behavior/Strategy/ConstStrategy.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Model/Behavior/Strategy/ConstStrategy.php b/src/Model/Behavior/Strategy/ConstStrategy.php index 6bd80fe..735fad9 100644 --- a/src/Model/Behavior/Strategy/ConstStrategy.php +++ b/src/Model/Behavior/Strategy/ConstStrategy.php @@ -132,6 +132,8 @@ public function beforeFind(EventInterface $event, Query $query, ArrayObject $opt $constant = Hash::get($row, $this->getConfig('field')); + if ($constant instanceof Entity) return $row; + $field = Inflector::singularize(Inflector::underscore($this->alias)); $value = new Entity([ 'label' => Hash::get($this->getConstants(), $constant, $constant),