Have a look at EntityManager::getReference() If an entity has been loaded already, getReference() will return that entity. But if it isn't loaded yet, it will return a Proxy. I think this is what you're searching for :)
-- Jasper N. Brouwer (@jaspernbrouwer) On 20 Feb 2014, at 20:42, Stephen Leavitt <[email protected]> wrote: > Ok, I've pretty much solved my issue by keeping tracking of an integer field > on the entity for storing the primary key of the entity on the other entity > manager, and implementing an entity listener as a service in symfony using > prePersist, preUpdate, and postLoad events, and this seems to work well. > > The one question I do have is if it is possible to retrieve an entity as an > entity proxy intentionally, so that way I can treat the linked entity as an > association and load it using lazy loading even though it technically isn't > an association. If this is not possible or is too difficult to implement, I'm > ok with that, as I'm not encountering any issues currently. Might be a case > of premature optimization on my part, but I was just wondering if anyone had > ever done it. > > Thanks. -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
