mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Simple Derived Identity issue #6153
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fabienlem on GitHub (Jan 10, 2019).
Originally assigned to: @Ocramius on GitHub.
Hello,
I'm struggling with an issue based on the use case that is described here: Use-Case 2: Simple Derived Identity
Support Question
I have the following Doctrine entities and mapping in my Symfony app:
Every time I perform a DQL query that involves the User entity, Doctrine performs one additional query per matching User to retrieve the corresponding Address entity. That happen every time, even if the Address data are never used in the code.
I tried to reproduce this issue on a vanilla Symfony installation, and I faced another issue, I'm not able to perform the following code as I get an error (
Entity of type AppBundle\Entity\Address is missing an assigned ID for field 'user'):Do you have any hint of what is wrong?
Best regards
@Ocramius commented on GitHub (Jan 10, 2019):
This is correct behavior in a one-to-one association, because your
Addressis the owning side of the association, so theUserneeds to load it.@fabienlem commented on GitHub (Jan 10, 2019):
Thank you @Ocramius for your reply.
But the problem is that if I retrieve 10,000 Users, 10,000 queries are performed to retrieve Addresses... Is it possible to change this behavior?
The following code doesn't help:
@Ocramius commented on GitHub (Jan 10, 2019):
A fetch-join should definitely remove this behavior: can you try an upgrade to 2.6.x and see if there's a change, first?
@fabienlem commented on GitHub (Jan 10, 2019):
I don't take advantage of PHP 7.1 for now... so I can't upgrade :(
I confirm the issue happen even with a fetch-join.
@Ocramius commented on GitHub (Jan 10, 2019):
Yeah, on this end we'll need you to check on 2.6+ first, and otherwise provide a failing test case against this test suite.
We don't support 2.5.x anymore, unless it is about security issues.
@fabienlem commented on GitHub (Jan 10, 2019):
Ok! I continue to investigate on my side and I'll let you know if I solved the issue. Thank you a lot for your quick replies. Have a nice day!