Closed kaihoefler closed 5 months ago
Thank you for the detailed information about the problem, i prepared a pull request https://github.com/CakeDC/Enum/pull/60 to address this issue, it is currently in review.
Thanks for reacting so fast.
@kaihoefler version https://github.com/CakeDC/Enum/releases/tag/3.1.0 released with the fix to the issue
I used CakeDC/Enum in my project and migrated to CakePHP 5.0 and now have problems with the implementation of the ConstStrategy.
In the branch 3.next-cake5 @arusinowski introduced with commit 0447fec5b1b6eb883b79a257920671f630bb4c74 an changed the following lines:
$query->formatResults(function (CollectionInterface $results) { return $results->map(function ($row) { if (is_string($row) || !$row) { return $row; }
to$query->formatResults(fn(CollectionInterface $results) => $results ->map(function (EntityInterface $row): EntityInterface {
But as the $row could also be an array if you have a non hydrated result or if you call the exists(ID) function on a modell, this does not work as expected.
This change has not been merged with the master branch. Therefore the fix #55 is actually not relevant for the master branch but only for the 3.next-cake5 branch.
@arusinowski : Is it possible for you to fix this? Thanks.