Closed eerison closed 2 years ago
let me know if does it make sense, if yes I'll open a Pull request :)
There is already the call $this->admin->create($snapshot);
Wouldn't it better to create an AdminExtension to dispatch action after every action create/edit/... The AdminExtension could be here: https://github.com/sonata-project/SonataAdminBundle/tree/3.x/src/Admin/Extension And then the SnapShot admin could use this admin extension.
@VincentLanglet Hmmm I don't fully understand how it works.
could you give any example?
If we're doing something like https://github.com/sonata-project/SonataAdminBundle/blob/3.x/src/Admin/Extension/LockExtension.php
Implementing all the PostCreate, PostUpdate, PostDelete, etc methods and dispatching an event inside.
Then, the admin class will call these method https://github.com/sonata-project/SonataAdminBundle/blob/3.x/src/Admin/AbstractAdmin.php#L616 if the Extension is added to the admin.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Add EventDispatcher after update or create an snapshot
after create a snapshot I will dispatch an event to be able create listeners for who implement this lib.
e.g:
I'll put this after this line https://github.com/sonata-project/SonataPageBundle/blob/3.x/src/Controller/SnapshotAdminController.php#L67