core
core copied to clipboard
feat: separate the persist logic from the back-office controller
(Work in progress)
Bolt has an event mechanism that allows developers to get notified and execute code when content or users are getting changes. But these events are currently dispatched by the Bolt\Controller\Backend\ContentEditController
controller. As a consequence, developers cannot take advantage of these events in their own code.
In this PR, I propose to create two new data manager classes (one per data type: user and content) that would take care of the task to persist the entities, and dispatch the relevant events.
This PR introduces four new events too, {PRE,POST}_PERSIST
and {PRE,POST}_FLUSH
, so the developers can subscribe to new intermediate states without breaking the backward compatibility.
Neat! 👀
ECS is compaining about some Code Style things. These are easily fixed by running make csfix
when you're done with this PR. :-)
Very cool stuff, @Deuchnord 👏
Just need to write tests, and I'll make this RFR.