F
F
fuck__all__humans2017-02-12 21:51:43
Yii
fuck__all__humans, 2017-02-12 21:51:43

How to combine Yii2 validation rule?

Hello! I have a table with categories, let's imagine that there are 3 fields that I need for validation: parent_id, alias, id. I need to create a validation rule (the rules method in the model), so that both the id and alias pair are unique, while parent_id == null, can this be implemented with one rule or do I need to write my own method? While stopping at this

[['alias'], 'unique, 'targetAttribute' => ['alias', 'id'] ]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question