Working with Doctrine ORM, is it possible to enable auto eager loading of related records when using in a getter ? (without explicit leftJoins())
I know I can use a leftJoin() to obtain the object with related records, but I want to avoid creating a DQL query for every object and simply have some kind of automatic "prefetching" of related records.
This is useful when you have to cycle through nested Doctrine_Records and it's exactly the same functionality that Kohana ORM has through th开发者_JAVA技巧e with() statement:
http://docs.kohanaphp.com/libraries/orm#with
(It simply executes the query with the joins even if you get only the 'root' record with the array syntax).
I'm not sure I understood but you may find answer in doctrine doc :
$users->loadRelated('Phonenumbers');
精彩评论