Answer the question
In order to leave comments, you need to log in
Is it possible to set a unique validation rule for 2 fields?
There is a table of dictionary elements (id, dictionary id, key, value). Is it possible to set a validation rule at the framework level for the uniqueness of the id-dictionary + key-element binding?
Answer the question
In order to leave comments, you need to log in
[
[
'id_словаря',
'key'
],
'unique',
'targetAttribute' => [
'id_словаря',
'key'
]
],
I can offer a bike. Store in the md5 database (id.key) and check it for uniqueness.
The validator has two interesting properties:
targetAttribute and comboNotUnique.
Read the help for these attributes and see the validator source code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question