DDC-1188: EntityManager and EntityRepository find methods: Load relation "on Demande" #1490

Closed
opened 2026-01-22 13:16:04 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 2, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user benoit:

I use the method "find()" from the entityManager to get my entity like that:

$op = $this->_em->find('Diagnosers', 1);

So I get my Diagnosers entity fullfilled, with proxy object instead of the object at the relation (with default loading settings).
But sometimes, i know that my object proxy will be used, so i would like to enforce its loading, and just do one request to
the database server.

So for doing this, i could make my own request into my entity repository, and call it instead of using the find() method.
But it could be fun to do:

$op = $this->_em->find('Diagnosers', 1, array('RelNameOne', 'RelNameTwo'));

Pass an array parameter to the find method, expect that it load the relation just for this call.

Originally created by @doctrinebot on GitHub (Jun 2, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user benoit: I use the method "find()" from the entityManager to get my entity like that: $op = $this->_em->find('Diagnosers', 1); So I get my Diagnosers entity fullfilled, with proxy object instead of the object at the relation (with default loading settings). But sometimes, i know that my object proxy will be used, so i would like to enforce its loading, and just do one request to the database server. So for doing this, i could make my own request into my entity repository, and call it instead of using the find() method. But it could be fun to do: $op = $this->_em->find('Diagnosers', 1, array('RelNameOne', 'RelNameTwo')); Pass an array parameter to the find method, expect that it load the relation just for this call.
admin added the Improvement label 2026-01-22 13:16:04 +01:00
admin closed this issue 2026-01-22 13:16:06 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 5, 2011):

Comment created by @beberlei:

This is a duplicate, 2.1 now has functionality to configure eager loading using the Query::setFetchMode() on DQL queries. This will not be possible on a simple find method, however find() now respects FETCH_EAGER and joins entities correctly, so you can configure a default setup for loading related associations.

@doctrinebot commented on GitHub (Jun 5, 2011): Comment created by @beberlei: This is a duplicate, 2.1 now has functionality to configure eager loading using the Query::setFetchMode() on DQL queries. This will not be possible on a simple find method, however find() now respects FETCH_EAGER and joins entities correctly, so you can configure a default setup for loading related associations.
Author
Owner

@doctrinebot commented on GitHub (Jun 5, 2011):

Issue was closed with resolution "Duplicate"

@doctrinebot commented on GitHub (Jun 5, 2011): Issue was closed with resolution "Duplicate"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1490