Skip to content

Commit

Permalink
Merge pull request #56 from kaihoefler/master
Browse files Browse the repository at this point in the history
Fixing Issue with $constant beeing of type /Cake/ORM/Entity
  • Loading branch information
skie authored Apr 9, 2024
2 parents cf3a212 + b4393ce commit 2bed5b5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Model/Behavior/Strategy/ConstStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ 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),
Expand Down

0 comments on commit 2bed5b5

Please sign in to comment.