mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #9663] ScalarColumnHydrator: prevent early-bail on falsy values #11782
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/9663
State: closed
Merged: Yes
Hi !
This is my first contribution to Doctrine, please let me know if there is anything I can do to facilitate the review process.
--
Fix #9230
Falsy values stop the hydration process in
$query->getSingleColumnResult(). If the array of values fetched from the database contains a value that is "falsy", every value after that value and including that value is missing from the array that is returned.This is because of the way the database values are retreived in ScalarColumnHydrator :
f4d5283f70/lib/Doctrine/ORM/Internal/Hydration/ScalarColumnHydrator.php (L31-L33)This PR fixes that by fetching all the values and returning them as is. As before, and to keep things consistent with the previous behavior of both ScalarHydrator and ScalarColumnHydrator, no type conversion is done between the database value and the PHP value. According to a comment in
AbstractHydrator, this is the expected behavior for scalar hydrators that is a legacy behavior from 2.0 :f4d5283f70/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php (L498-L505)