netvlies/DoctrineBridgeBundle

Updating existing entities doesn't work

Opened this issue · 3 comments

When an entity with a bridge to a document is loaded from the database and gets persisted again the following error occurs:

Catchable Fatal Error: Object of class PHPCRProxies__CG__\Netvlies\Bundle\AcmeBundle\Document\TheaterShow could not be converted to string in /home/vagrant/vhosts/acme/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 1199

I think the changeset needs to be recomputed as it tries to save the object and not the converted value.

@hacfi could you make a pr for this? you are probably better aware of this code then us at this point.

With the current architecture of the PHPCR ODM UnitOfWork you can't persist a document without updating the entity. It would be if we'd use the preFlush event. I'll look into it to find out if that's an option,