示例#1
0
 /**
  * Validator constructor.
  * @param array $rules Array where each key corresponds to one attribute of the model and the value is a list of
  *                     validation rules supported by Respect\Validation separated by the pipe ("|") character.
  */
 public function __construct(array $rules)
 {
     foreach ($rules as $field => $rule) {
         $this->addAttribute($field, $rule);
     }
     parent::__construct();
 }