neo4j-php-ogm
neo4j-php-ogm copied to clipboard
Add events to UnitOfWork
Implement lifecycle events similar to doctrine-orm: http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/events.html
Since much of the implementation resides in doctrine/common, I'm hoping I'll be able to get at least some of the events implemented this weekend without too much trouble.
Thanks, yeah this is planned of course but not really in the priorities for now, if you come up with a PR that would be wonderful.
@AndrolGenhald Do you have any progress on this, if yes please open a PR so I can contribute and make some improvements for this implementation.
I haven't started anything yet, I spent last night looking through doctrine-orm's implementation of lifecycle events. I was planning working on it over the weekend.
Right, I'll check also and maybe prepare some entry points for it. Thanks !
What is your actual use case for doctrine events ?
Ha yeah, DoctrineModule Form element
I'm mainly looking to subscribe to the onFlush event to create historical copies of entities when they are changed, right now I'm handling it everywhere I call flush.
Interesting ! Do you have a screenshot of what your graph looks like after the historic is created ? You can even share privately if you want : christophe at graphaware dot com
Sequence of events:
- Add 'Entity'
- Add 'attribute 1'
- Add 'attribute 2'
- Rename 'Entity' -> 'Entity (changed)'
- Add 'attribute 3'
- Rename 'attribute 1' -> 'attribute 1 (changed)'
- Rename 'Entity (changed)' -> 'Entity (changed again)'
Very cool !
There seems to be no recomputeSingleEntityChangeSet($meta, $entity);
in unit of work. Wanted to create an event listener for onFlush
so User::updatedAt
field is set to current timestamp on node update.