Skiponempty In Yii2 Vs Setonempty In Yii1

Just wanted to know the difference.

As per the new Default Validator in Yii2, the default value does not change if the value is not NULL.

In my example for updated_by attribute, it does not update to a new one if the value is already set.



skipOnEmpty in 2.0 is the same as allowEmpty in 1.1. If it is set to true then validation will be skipped in case of empty value and in case of default validator it will result in not applying this validator at all.

If value isn’t empty then there’s no sense to apply default.