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

Changing the hydration mode doesn't give the same type of result for BigInt #11527

Open
VincentLanglet opened this issue Jun 26, 2024 · 0 comments

Comments

@VincentLanglet
Copy link
Contributor

Bug Report

Q A
BC Break no
Version 2.19

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 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.

Is there a valid reason for not having basically

HYDRATE_SCALAR_COLUMN = array_column(HYDRATE_ARRAY, 0)
@VincentLanglet 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
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

1 participant