Use an attribute value for validation?

I have a table that has ‘cidr_block’ and ‘gateway’ fields. I would like to know if it is possible to use ‘cidr_block’ to validate ‘gateway’ in the rules[]?

Something like:




    [['cidr_block', 'gateway'], 'required'],

    [['gateway'], 'ip', 'ranges'=>'cidr_block'],



http://www.yiiframework.com/doc-2.0/guide-input-validation.html#multiple-attributes-validator

Saw that. Wondering if there is a way within the rules array.

Is it possible to use:


[['gateway'], 'ip', 'ranges'=>$this->cidr_block],