Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate properties into serialized string and object #3

Open
hacfi opened this issue Oct 24, 2013 · 0 comments
Open

Separate properties into serialized string and object #3

hacfi opened this issue Oct 24, 2013 · 0 comments

Comments

@hacfi
Copy link
Owner

hacfi commented Oct 24, 2013

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

ORM entity:
https://github.com/ecommerce/EcommerceCoreBundle/blob/master/Doctrine/Orm/ProductReference.php

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 .

/cc @psren @lsmith77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant