I know there is the default vlaidator which produces a default value but when I create a new model like:
new Series()
the default rules:
['stdo_allowed', 'default', 'value' => 1],
['completion_status', 'default', 'value' => 2],
Are not actually applied.
Am I just blind or is there currently no way to set defaults for new objects?
Related to #2726
you can set defaul values by overriding the init() method and set them there.
Default values in validators are to be used when input data is empty.
The difference is as follows:
marked this issue as docs.
Ok kool thanks, my Googling failed me there
Most helpful comment
you can set defaul values by overriding the
init()method and set them there.Default values in validators are to be used when input data is empty.
The difference is as follows:
marked this issue as docs.