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.

On Tuesday, February 11, 2014 9:46:54 AM UTC-6, Stephen Leavitt wrote:
>
> Any ideas on how I could go about maintaining the associations such that 
> things like forms / pagination / etc. can access these objects the same as 
> if they were managed by the same entity manager (I have some thoughts on 
> how else to handle this, but I'm open to suggestions on this problem so I 
> don't overlook any solutions I might not have thought of before).
>
> Thanks for the reply!
>
> On Monday, February 10, 2014 4:38:04 PM UTC-6, Marco Pivetta wrote:
>>
>> Hi Stephen,
>>
>> If you have to work with different servers when working with Doctrine ORM 
>> (and especially different DB types), I am afraid that you will have to keep 
>> the entities completely separate and solely linked by identifier references 
>> (no direct mapping).
>>
>> Cheers,
>>
>> Marco Pivetta 
>>
>> http://twitter.com/Ocramius      
>>
>> http://ocramius.github.com/
>>  
>>
>> On 10 February 2014 17:42, Stephen Leavitt <[email protected]> wrote:
>>
>>> I have a legacy application that was using Xaraya to manage user content 
>>> that I am trying to replace with a rewrite using Symfony/Sonata to manage 
>>> users and/or content.
>>>
>>> For whatever reason, previous developers managed this with two different 
>>> databases (MySQL for Xaraya, and SQL Server for other things, including 
>>> authenticating users).
>>>
>>> I am trying to create Entity mappings such that the users/groups from 
>>> SonataUserBundle (which extends FOSUserBundle) use the entity manager 
>>> associated with the login database connection, and this works for logging 
>>> into the admin site itself, but blows up when it tries to hydrate objects 
>>> that have associations to the User entity.
>>>
>>> It appears that Doctrine does not try to find the entity manager 
>>> associated with an entity when hydrating an object's associations.
>>>
>>> My question is this: it it possible to make Doctrine hydrate objects 
>>> using the entity manager for an entity instead of assuming it's mapped to 
>>> the current entity manager, and if not, is there any form of a clean code 
>>> work-around for it?
>>>
>>> Thanks.
>>>
>>> (Note: The method of using the "databasename.tablename" syntax in the 
>>> query that I have seen mentioned elsewhere will not work for my use case.)
>>>
>>> -- 
>>> 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.
>>>
>>
>>

-- 
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.

Reply via email to