mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
getScalarResult does not return integer or floats as correct type #6091
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?
Originally created by @alexander-schranz on GitHub (Oct 30, 2018).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Summary
getScalarResult does not return integer or floats just strings it should convert scalar fields like integer, floats into the correct format.
Current behavior
getScalarResult return all columns as strings instead of scalar values.
How to reproduce
Use
getScalarResulton a query which should return integer, float fields.Expected behavior
getScalarResultshould return scalar types in correct type instead of string. Maybe add a new methodgetRawResultfor returning all fields as string.@Ocramius commented on GitHub (Nov 4, 2018):
This is correct and expected, since there is no way for the ORM to know what kind of mapping is to be used for a retrieved value.
Should we use the DQL AST to decide what kind of type the retrieved value should have, then we'd be introducing a BC break for consumers that rely on the value being
stringright now.Closing as
invalid.@alexander-schranz commented on GitHub (Nov 5, 2018):
@Ocramius thx for your answer. Think
getScalarResultis misleading and should maybe be renamed in the next major release then. And then a hydration mode which really return only scalar values could be introduced.@Ocramius commented on GitHub (Nov 5, 2018):
We can maybe add a method, and deprecate this one, but changing it is too
risky, given the amount of consumers.
On 5 Nov 2018 10:34, "Alexander Schranz" notifications@github.com wrote:
@Ocramius https://github.com/Ocramius thx for your answer. Think
getScalarResult is misleading and should maybe be renamed in the next major
release then. And then a hydration mode which really return only scalar
values could be introduced.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7447#issuecomment-435810535,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakORKhJ6VbTHkmU22Cjyi8An3A0QMks5usAYxgaJpZM4YBoaU
.