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

Collection is hydrated as empty if first row contains nulls from a leftJoin #9807

Closed
freiondrej-lmc opened this issue Jun 2, 2022 · 1 comment · Fixed by #9870
Closed
Labels

Comments

@freiondrej-lmc
Copy link

Bug Report

Q A
BC Break no
Version 2.11.3

Summary

When the first row of a leftJoin result contains null values (because of a SqlFilter), the collection is hydrated as empty.

Current behavior

The collection is hydrated as empty if the first row is nullish.

How to reproduce

Details for reproduction is in https://github.com/freiondrej-lmc/doctrine_orm_bug_reproduction .

Expected behavior

The Collection should be hydrated with existing data.

@derrabus derrabus added the Bug label Jun 2, 2022
@freiondrej-lmc
Copy link
Author

Found #9230, but I don't know if that is actually similar, or only looks similar but is a different problem. 🤔

popov-a-e added a commit to popov-a-e/orm that referenced this issue Jun 28, 2022
popov-a-e added a commit to popov-a-e/orm that referenced this issue Jul 1, 2022
…ydration is complete

If ObjectHydrator faces an empty row to an uninitialized collection, it initializes it, to prevent it from querying again (DDC-1526). However, if that row is the first but not the only in the collection, the next rows will be ignored, as the collection will be considered "existed", and "existed" collections are only replaced if REFRESH hint is present. To prevent it, we defer initialization to the end of the hydration.

Fixes doctrineGH-9807
popov-a-e added a commit to popov-a-e/orm that referenced this issue Jul 1, 2022
…ydrator

If ObjectHydrator faces an empty row to an uninitialized collection, it initializes it, to prevent it from querying again (DDC-1526). However, if that row is
the first but not the only in the collection, the next rows will be ignored, as the collection will be considered "existed", and "existed" collections are only
replaced if REFRESH hint is present. To prevent it, we defer initialization to the end of the hydration.

Fixes doctrineGH-9807
popov-a-e added a commit to popov-a-e/orm that referenced this issue Jul 1, 2022
If ObjectHydrator faces an empty row to an uninitialized collection, it initializes it, to prevent it from querying again (DDC-1526). However, if that row is the first but not the only in the collection, the next rows will be ignored, as the collection will be considered "existed", and "existed" collections are only replaced if REFRESH hint is present. To prevent it, we defer initialization to the end of the hydration.

Fixes doctrineGH-9807
popov-a-e added a commit to popov-a-e/orm that referenced this issue Jul 1, 2022
If ObjectHydrator faces an empty row to an uninitialized collection,
it initializes it, to prevent it from querying again (DDC-1526).
However, if that row is the first but not the only in the collection,
the next rows will be ignored, as the collection will be considered
"existing", and "existing" collections are only replaced if REFRESH hint
is present. To prevent it, we defer initialization to the end of the
hydration.

Fixes doctrineGH-9807
popov-a-e added a commit to popov-a-e/orm that referenced this issue Jul 3, 2022
If ObjectHydrator faces an empty row to an uninitialized collection,
it initializes it, to prevent it from querying again (DDC-1526).
However, if that row is the first but not the only in the collection,
the next rows will be ignored, as the collection will be considered
"existing", and "existing" collections are only replaced if REFRESH hint
is present. To prevent it, we defer initialization to the end of the
hydration.

Fixes doctrineGH-9807
greg0ire added a commit that referenced this issue Jul 3, 2022
[GH-9807] Fix: initialize potentially empty collections at the hydration complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants