mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1188: EntityManager and EntityRepository find methods: Load relation "on Demande" #1490
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 @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.
@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):
Issue was closed with resolution "Duplicate"