You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm note sure if it's a bug or a wanted behavior (and for what reason) but the type of a bigint value is return by a query is different when changing the Hydration mode. Let's take
Current behavior
With HYDRATE_OBJECT or HYDRATE_ARRAY I'm getting ["42"],
but with HYDRATE_SCALAR or HYDRATE_SINGLE_SCALAR, I'm getting [42]and withHYDRATE_SCALAR_COLUMNI'm getting42`.
How to reproduce
$this->createQueryBuilder('d')
->select('d.id') // where the id is a bigInt field
->setMaxResults(1)
->getQuery()
->getSingleResult();
Expected behavior
I would expect to get "42" everytime (in DBAL 3).
This is kinda fixed by DBAL 4 where int will be the type of value in HYDRATE_OBJECT or HYDRATE_ARRAY if think for bigInt.
But I wonder, if this happen for bigint in DBAL 3, this might happen for some other value/type. This would require investigation but I prefer first to know if it's considered as a bug or done by design.
The text was updated successfully, but these errors were encountered:
VincentLanglet
changed the title
Hydration mode doesn't give the same type of result for BigInt
Changing the hydration mode doesn't give the same type of result for BigInt
Jun 26, 2024
Bug Report
Summary
Hi.
I'm note sure if it's a bug or a wanted behavior (and for what reason) but the type of a bigint value is return by a query is different when changing the Hydration mode. Let's take
Current behavior
With
HYDRATE_OBJECT
orHYDRATE_ARRAY
I'm getting["42"]
,but with
HYDRATE_SCALAR
orHYDRATE_SINGLE_SCALAR, I'm getting
[42]and with
HYDRATE_SCALAR_COLUMNI'm getting
42`.How to reproduce
Expected behavior
I would expect to get
"42"
everytime (in DBAL 3).This is kinda fixed by DBAL 4 where
int
will be the type of value inHYDRATE_OBJECT
orHYDRATE_ARRAY
if think for bigInt.But I wonder, if this happen for bigint in DBAL 3, this might happen for some other value/type. This would require investigation but I prefer first to know if it's considered as a bug or done by design.
Is there a valid reason for not having basically
The text was updated successfully, but these errors were encountered: