Closed
Description
I think we can "easily" improve the QueryResultDynamicReturnTypeExtension to supports more than HYDRATE_OBJECT
.
Click here to see the different hydration modes
-
HYDRATE_OBJECT: Default behavior, return the result without modifications.
-
HYDRATE_ARRAY: Every object are transformed to an array, so
array<array{id: int, language: string}>
is untouched, but
array<array{id: int, user: User}>
would be transformed to
array<array{id: int, user: array{username: ..., email:..., ....}}>
- HYDRATE_SCALAR: Kinda like the HYDRATE_ARRAY, but everything is merged inside a single array, so
array<array{id: int, language: string}>
is untouched, but
array<array{id: int, user: User}>
would be transformed to
array<array{id: int, u_username: ..., u_email:..., ....}>
- HYDRATE_SINGLE_SCALAR: Kinda like the HYDRATE_SCALAR, but only one key inside the array will be supported
array<array{id: int}>
is untouched, but
array<array{user: User}>
would be transformed to
array<array{u_username: ...}> // Only if there is only one property inside the object
- HYDRATE_SCALAR_COLUMN: Kinda like the HYDRATE_SINGLE_SCALAR, but the single-array element is replaced by the element.
array<array{id: int}>
is changed to
array<int>
- HYDRATE_SIMPLEOBJECT: I don't really know this one.
I would say that good steps would be
- Infer the result when there is no
object
inside the result (for most of the hydration mode it's like HYDRATE_OBJECT) - Infer the result when there is an
object
inside the result by replacing toarray<string, mixed>
Metadata
Metadata
Assignees
Labels
No labels