Answer the question
In order to leave comments, you need to log in
How to search for 2 fields at once in Exist Validator?
Hi friends!
There is a need to check the existence of a record in the database during validation, but only look for not one field in the table, but two. Can this be done using the standard exist-validator methods?
Now it looks like this:
['zip', 'exist', 'targetClass' => ZipKz::className(), 'targetAttribute' => 'zip_new', 'when' => function($model){
return $model->geo == 'KZ';
}],
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question