/** * Validates the specified object. * * @param \Model $object the data object being validated * @param array $attributes the list of attributes to be validated. Defaults to null, * meaning every attribute listed in {@link attributes} will be validated. */ public function validate($object, $attributes = null) { if (is_array($attributes)) { $attributes = array_intersect($this->attributes, $attributes); } else { $attributes = $this->attributes; } foreach ($attributes as $attribute) { if (!$this->skipOnError || !$object->hasErrors($attribute)) { $this->validateAttribute($object, $attribute); } } }