How to avoid sub-queries with 1-to-1 relations? #9122
Replies: 2 comments
-
I have a similar issue. It would be great if the OneToOne association would respect the "fetch" value of LAZY or EXTRA_LAZY. However, if the OneToOne association is not going to respect the fetch values of LAZY or EXTRA_LAZY (even if only in certain situations like inverse side), then perhaps an exception being thrown in those circumstances would be appropriate when fetch is not explicitly EAGER on an inverse side of a OneToOne association. This would make the developer aware of exactly what could happen before going to production and allow them to fix it by explicitly setting fetch to EAGER and understand that doing so will incur the additional queries and potential performance issues. |
Beta Was this translation helpful? Give feedback.
-
Well, i guess thats two different problems..or maybe three: i found:
actually did the trick (even without setting the modified data via |
Beta Was this translation helpful? Give feedback.
-
I have an simple 1-to-1 relation:
When i fire this:
Then the hydrator fires sub-queries to resolve the institution->institutionSettings relation. I tried to specify the relation as
lazy
, but it turns out thatUnitOfWork.php
has(which is a semi-nice behavior btw, options shouldnt be silently ignored..but ok)
For what im doing the related settings are not needed at all, so it would be totally fine if the relation is ignore or something, but i cant make that work. I also tried joining the settings:
so now the data would be in the response from the db, but it doesnt help, the hydrater/UoW still creates sub-queries.
Is there any way to not end up with sub-queries?
Beta Was this translation helpful? Give feedback.
All reactions