Replies: 1 comment 2 replies
-
I'm reading more about Lazy Objects I think the only way to solve this, would be to make the entity itself a Lazy Ghost with all the OneToOne properties uninitialized. When such OneToOne property is called, it will then trigger the initializer function for the Lazy Ghost that would then fill in all the OneToOne relations. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been following the work done on Native Lazy Objects in #11853.
Would it be possible to use this technique for preventing loading of the Bidirectional OneToOne relation when fetching the entity from the non-owning side?
Take a look at the example from the docs:
The Cart is the owner of the relationship since it has the JoinColumn defined.
When you fetch the Customer entity, Doctrine always does an additional query to check if there is a Cart or not.
Ideally, this only happens when
$user->cart
is used. With Native Lazy Objects this should be possible to implement, if I understand correctly./cc @beberlei
Beta Was this translation helpful? Give feedback.
All reactions