8000 Single column hydration returns nothing if first item is false-like · Issue #9230 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Single column hydration returns nothing if first item is false-like #9230
Closed
@TomaszGasior

Description

@TomaszGasior

Bug Report

Q A
BC Break no
Version 2.10.3

Summary

While working on my open source app I found out that scalar column hydration does not return any value, just empty array, when first element of the results is false-like (null, 0, ''…).

How to reproduce

Do something like this but without <> NULL and <> '': https://github.com/TomaszGasior/RadioLista-v3/blob/8a2b4fa0d6d9fb85d83a36a00bd61d2031a1a8b3/src/Repository/RadioStationRepository.php#L68

Simplified example:

return $this->createQueryBuilder('radioStation')
    ->select('DISTINCT radioStation.'.$column)
    ->getQuery()
    ->getSingleColumnResult()
;

If first item from result set is false-like, empty array is returned.

Expected behavior

I would like to get all values from the column, even something like null, ''.

Adding false !== to

while ($row = $this->statement()->fetchOne()) {
kinda fixes the issue. I don't know whether Doctrine is able to return native false for DBMS-es supporting it and how to support that case if it's needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0