Closed Erwane closed 2 years ago
Thanks @Erwane for the interesting proposal. I suppose that this could be useful for costly setters, such as hashing of passwords.
The approach I propose is:
$skippedSetters
property in the factories, enabling to disable per default the setters for an array of fieldsskipSetterFor()
method @Erwane here is a PR you might want to have a look at.
Very nice. I just added a comment on DataCompiler::setSkippedSetters
I cannot see your comment @Erwane ?
When setting data (with
make()
,setField()
orpatchData()
), if the entity have a_setField()
method, the data is altered. It will be nice to add an option to skip this setters.There is two ways to deactivate usage of setters :
__construct()
https://api.cakephp.org/4.4/class-Cake.ORM.Entity.html#__construct() with theuseSetters
option.set()
https://api.cakephp.org/4.4/class-Cake.ORM.Entity.html#set() withsetter
option.