Is there a way in Flow to hook into or extend the update method/function of a repository? I like to create several messages (as objects) if an object changes anyhow.
Currently we use the UnitOfWork in the controller after we give the object to the repository to update. But with that the messaging just works there in that function and not "global" where ever I update that object.
I don't like the idea of putting that in to the setters of that object. That would be nasty code in my opinion.
Any ideas?
You can try to make
YourRepositorywhich will be extendingRepositoryand implement yourupdate()method (or callparent::update()and implement rest of your logic). All your repositories should then inheritYourRepositoryclass instead ofRepository.Create
YourRepository:or copy-paste
update()method body fromRepositoryclass and add your logic:Each repository of domain
Modelshould now inherits fromYourRepository: