But this is not a bug, not all database management systemare the same with mysql.
So if you want to validate an attribute only when it not empty. Try the following rules :
['phone', 'filter', 'filter' => 'trim'], //trim string
['phone', 'default'], //set null if empty string
['phone', 'unique'],
Refer :
http://www.yiiframework.com/doc-2.0/guide-tutorial-core-validators.html
sinhji
ReplyDeleteThank u guy, you are cool man!!!
ReplyDelete