/** * @inheritdoc */ public function rules() { $rules = parent::rules(); if ($this->numeric) { $rules[] = [$this->attr, 'integer', 'except' => [ActiveRecord::SCENARIO_SEARCH]]; } if ($this->numeric and $this->defaultValue === null) { $rules[] = [$this->attr, 'default', 'value' => 0, 'except' => [ActiveRecord::SCENARIO_SEARCH]]; } return $rules; }
/** * @inheritdoc */ public function rules() { $rules = parent::rules(); $rules[] = [$this->attr, 'filter', 'filter' => 'trim']; return $rules; }
/** * @inheritdoc */ public function rules() { $rules = parent::rules(); $rules[] = [$this->attr, 'default', 'value' => 0, 'except' => ActiveRecord::SCENARIO_SEARCH]; return $rules; }