sdlins / yii2-at-least-validator

Makes one or more attributes mandatory inside a set of attributes.
Apache License 2.0
28 stars 19 forks source link

Max quantity of chosen attributes #11

Open Maykonn opened 7 years ago

Maykonn commented 7 years ago

Suppose that I have two fields, product 1 and product2. How to avoid that the two be filled but at least one must be filled?

Something like this is possible?

[
    ['product1', 'product2'], 
    AtLeastValidator::className(), 
    'in' => ['product1', 'product2'], 
    'max' => 1
],
sdlins commented 7 years ago

@Maykonn ... waiting your answer on the PR. Thank you.