-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I’ve stopped further development 3 months ago because the solution I came up with caused an update every time you persisted and there isn’t an easy fix for that due to Doctrine’s behaviour. More details can be found at doctrine/orm#617 (comment) . The solution stof suggested is to have seperate properties for that. It’s a simple fix but I didn’t like it so I put it on hold.
At the moment I always use a reference object in ORM for that ODM document. The entity in ORM just has the UUID of the document as an id and in my case a name property so you don’t have to load the ODM document if you just want to display the name. As those fields are hard-coded I didn’t create a new bundle for it. My use case are products of a webshop. Orders, categories, cart etc are all saved in ORM and only products are PHPCR ODM documents.
You can checkout some of the code here on github:
PHPCR ODM document:
https://github.com/ecommerce/EcommerceCoreBundle/blob/master/Doctrine/Phpcr/Product.php#L304-314
postLoad Doctrine Phpcr Listener adding a reference (lazyloading) to the entity after loading the document:
https://github.com/ecommerce/EcommerceCoreBundle/blob/master/EventListener/DoctrinePhpcrSubscriber.php#L45-50
same for the ORM entity to have a reference to the PHPCR ODM document:
https://github.com/ecommerce/EcommerceCoreBundle/blob/master/EventListener/DoctrineOrmSubscriber.php#L42-47
If anyone needs help to implement this contact me on twitter or freenode irc in #symfony-cmf .