yii\validators\RangeValidator::init PHP Метод

init() публичный Метод

public init ( )
    public function init()
    {
        parent::init();
        if (!is_array($this->range) && !$this->range instanceof \Closure && !$this->range instanceof \Traversable) {
            throw new InvalidConfigException('The "range" property must be set.');
        }
        if ($this->message === null) {
            $this->message = Yii::t('yii', '{attribute} is invalid.');
        }
    }

Usage Example

Пример #1
0
 public function init()
 {
     if (!is_string($this->enumClass)) {
         throw new InvalidConfigException('The "enumClass" property must be set.');
     }
     $consts = (new ReflectionClass($this->enumClass))->getConstants();
     $this->range = array_values($consts);
     parent::init();
 }
All Usage Examples Of yii\validators\RangeValidator::init