phpcr-odm
phpcr-odm copied to clipboard
Children not persisted when created in doctrine event listener
@petforsberg reported originally in https://github.com/doctrine/DoctrinePHPCRBundle/issues/179
Within my app, when I create an Article, app auto-generates a News for it. Both (Article and News) have their own children-nodes attached (always). The workflow looks like this:
- persist Article
- Doctrine EventListener - Article postPersist: create children, and set their Parent as Article
- Doctrine EventListener - Article postPersist: EventDispatcher -> generate News (creates new News document inside the other service)
- persist News (in the same service)
- Doctrine EventListener - News postPersist: create children, and set their Parent as News
Points 1-4 work well. But children persisted to another persisted Document - News - seem to be not persisted at all. I checked everything, it took me like 4 hours or so. Everything looks fine, objects are created, persisted, they exist... until I do flush. Then News children-elements disappear.
Do you know why does it happen?
Forgot to mention: when I create a bare News (not auto-generated in the nested Doctrine events), it is created without a problem, with its children.
see https://github.com/doctrine/DoctrinePHPCRBundle/issues/179 for previous discussion