public function setErrors($errors = array())
    {
        foreach ($errors as $error) {
            if (!$error instanceof ConstraintViolation) {
                throw new \InvalidArgumentException(sprintf('The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.', get_class($error)));
            }
        }

        $this->errors = $errors;
    }
public function setErrors($errors = array())
    {
        foreach ($errors as $error) {
            if (!$error instanceof ConstraintViolation) {
                throw new \InvalidArgumentException(sprintf('The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.', get_class($error)));
            }
        }

        $this->errors = $errors;
    }
public function setErrors ( $ errors = array ( ) ) { foreach ( $ errors as $ error ) { if ( ! $ error instanceof ConstraintViolation ) { throw new \ InvalidArgumentException ( sprintf ( 'The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.' , get_class ( $ error ) ) ) ; } } $ this -> errors = $ errors ; }
Validate and set errors.

@param ConstraintViolation[] $errors An array of ConstraintViolation instances.
Validate and set errors .