Add config options to allow fields to be updated using a setter method.
Feature request: #2644
This change is applied in Blameable, IpTraceable, SoftDeleteable & Timestampable annotations. The new attribute "setterMethod" can be passed to specify the setter method to be used for a field. If no setter method is specified, the property value would be set directly as before.
I would like to add tests for those changes as well. Do you want a separate/duplicated test for every affected annotation/listener?
I'm interested with this functionality.
I hope soon will merged to master.
I'm also interested in this functionality. At the moment I override and extend the BlameableListener to add this functionality but it was made final so that wont work for long 😄. Any chance we could have this functionality?
I'll try to find the time to add tests for the changes this week.
Alright, all done:
- I've rebased the branch,
- added the missing logic in the SoftDeleteable listener,
- fixed getting the property name in the annotation drivers
- and added Unit tests for all 4 annotations.
Let me know if you need anything else ;)
Any chance that this PR is getting merged?
Even though there is no BC breaking change right now: I could refactor the changes to auto-detect a setter method by simply checking for setFieldName(). That however could break BC as there's no way to stick to the original way of setting the property directly.
I'll rebase the latest changes right away. Many thanks for taking the time to review the changes!
Thanks for keeping working into this @fwolfsjaeger, in general I see the code fine, but I would like to avoid empty calls and we were also trying to not working with array references, I don't know how hard would be to make that change.
Sorry, but I'm no longer using DoctrineExtensions. I've created this and another PR about a year ago. That and the incompatibility with DBAL 4 forced me to just add my own listeners for the 3 attributes I was using.
I'll look into the recent deprecations and requested changes, but it might take some time.