I've setup a multi database connection on my ZF2 project with Doctrine, one to read from database and another to write.
Everything works good when used separately but when i try to use both on the same entity, like:
find a user:
$user = $this->getReaderObjectManager()->getRepository('Entity\User')->findOneBy(array('username' =>'xpto'));
and then try to change something:
$this->getWriterObjectManager()->persist($user); $user->setBlabla('bla');
and then try to flush it:
$this->getWriterObjectManager()->flush();
nothin' happens. no good.
It seems that readerObjectManager and writerObjectManager have their independent "entity pool", so i cant persist and change one entity from the other manager.
Is there a way to pass an entity from one manager to the other, or reference it, or simple that both managers share the same "entity pool"?
thanks in advance.