Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Branch 3.next-cake5 in ConstStrategy #59

Closed
kaihoefler opened this issue Apr 24, 2024 · 3 comments
Closed

Error in Branch 3.next-cake5 in ConstStrategy #59

kaihoefler opened this issue Apr 24, 2024 · 3 comments

Comments

@kaihoefler
Copy link
Contributor

kaihoefler commented Apr 24, 2024

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.

@arusinowski
Copy link
Member

Thank you for the detailed information about the problem, i prepared a pull request #60 to address this issue, it is currently in review.

@kaihoefler
Copy link
Contributor Author

Thanks for reacting so fast.

@arusinowski
Copy link
Member

@kaihoefler version https://github.com/CakeDC/Enum/releases/tag/3.1.0 released with the fix to the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants