Browse Source

Allow Validator::except to be either a string or an array.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
368dd4b1d4
  1. 12
      framework/yii/validators/Validator.php

12
framework/yii/validators/Validator.php

@ -94,7 +94,8 @@ abstract class Validator extends Component
*/
public $on = [];
/**
* @var array list of scenarios that the validator should not be applied to.
* @var array|string scenarios that the validator should not be applied to. For multiple scenarios,
* please specify them as an array; for single scenario, you may use either a string or an array.
*/
public $except = [];
/**
@ -163,12 +164,9 @@ abstract class Validator extends Component
public function init()
{
parent::init();
if (!is_array($this->attributes)) {
$this->attributes = (array)$this->attributes;
}
if (!is_array($this->on)) {
$this->on = (array)$this->on;
}
$this->attributes = (array)$this->attributes;
$this->on = (array)$this->on;
$this->except = (array)$this->except;
}
/**

Loading…
Cancel
Save