DDC-1154: Proxies should take convention while loading *ToOne associations to reduce 1 extra query #1448

Open
opened 2026-01-22 13:14:50 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (May 17, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @guilhermeblanco:

Read the IRC log:

[2:38pm] guilhermeblanco: beberlei: ping
[2:38pm] guilhermeblanco: I'm curious about a feature if Doctrine supports
[2:38pm] guilhermeblanco: if we do this on a proxy:
[2:38pm] guilhermeblanco: $proxy->getOneToOneAssoc()
[2:39pm] guilhermeblanco: shouldn't Doctrine already populate the assoc entity?
[2:39pm] guilhermeblanco: it would be an inner join
[2:39pm] beberlei: how would doctrine know it needs it?
[2:39pm] guilhermeblanco: beberlei: it always repass the ClassMetadata to Persister
[2:40pm] guilhermeblanco: so all needed item is to also pass the fieldname/assocname
[2:40pm] beberlei: but how would doctrine know getOneToOneASsoc() really returns this assoc
[2:40pm] beberlei: it could contain any logic
[2:40pm] guilhermeblanco: it wouldn't... but as soon as we trigger **load($fieldName)
[2:40pm] guilhermeblanco: we know that we could populate not only the Proxy, but also assoc
[2:40pm] beberlei: by convention?
[2:40pm] guilhermeblanco: ya
[2:41pm] beberlei: sounds good, can you open a ticket?
[2:41pm] guilhermeblanco: getUser() would trigger **load('user')
[2:41pm] guilhermeblanco: sure!
[2:41pm] guilhermeblanco: I'll pastie this as content... it would be awesome to have
[2:41pm] guilhermeblanco: I see a lot of queries here that could be optimized 
Originally created by @doctrinebot on GitHub (May 17, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @guilhermeblanco: Read the IRC log: ``` [2:38pm] guilhermeblanco: beberlei: ping [2:38pm] guilhermeblanco: I'm curious about a feature if Doctrine supports [2:38pm] guilhermeblanco: if we do this on a proxy: [2:38pm] guilhermeblanco: $proxy->getOneToOneAssoc() [2:39pm] guilhermeblanco: shouldn't Doctrine already populate the assoc entity? [2:39pm] guilhermeblanco: it would be an inner join [2:39pm] beberlei: how would doctrine know it needs it? [2:39pm] guilhermeblanco: beberlei: it always repass the ClassMetadata to Persister [2:40pm] guilhermeblanco: so all needed item is to also pass the fieldname/assocname [2:40pm] beberlei: but how would doctrine know getOneToOneASsoc() really returns this assoc [2:40pm] beberlei: it could contain any logic [2:40pm] guilhermeblanco: it wouldn't... but as soon as we trigger **load($fieldName) [2:40pm] guilhermeblanco: we know that we could populate not only the Proxy, but also assoc [2:40pm] beberlei: by convention? [2:40pm] guilhermeblanco: ya [2:41pm] beberlei: sounds good, can you open a ticket? [2:41pm] guilhermeblanco: getUser() would trigger **load('user') [2:41pm] guilhermeblanco: sure! [2:41pm] guilhermeblanco: I'll pastie this as content... it would be awesome to have [2:41pm] guilhermeblanco: I see a lot of queries here that could be optimized ```
admin added the Improvement label 2026-01-22 13:14:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1448