protected function validateParams(Validator $validator, array $params, ParameterBag $values)
    {
        $violations = new ConstraintViolationList();
        foreach ($params as $param) {
            if (empty($param['requirements'])) {
                continue;
            }
            $value = $values->get($param['name']);

            $paramViolations = $validator->validateValue($value, $param['requirements']);

            // add missing data
            foreach ($paramViolations as $violation) {
                $extendedViolation = new ConstraintViolation(
                    $violation->getMessage(),
                    $violation->getMessageTemplate(),
                    $violation->getMessageParameters(),
                    $violation->getRoot(),
                    $param['name'].$violation->getPropertyPath(),
                    $violation->getInvalidValue(),
                    $violation->getMessagePluralization(),
                    $violation->getCode()
                );

                $violations->add($extendedViolation);
            }
        }

        return $violations;
    }
protected function validateParams(Validator $validator, array $params, ParameterBag $values)
    {
        $violations = new ConstraintViolationList();
        foreach ($params as $param) {
            if (empty($param['requirements'])) {
                continue;
            }
            $value = $values->get($param['name']);

            $paramViolations = $validator->validateValue($value, $param['requirements']);

            // add missing data
            foreach ($paramViolations as $violation) {
                $extendedViolation = new ConstraintViolation(
                    $violation->getMessage(),
                    $violation->getMessageTemplate(),
                    $violation->getMessageParameters(),
                    $violation->getRoot(),
                    $param['name'].$violation->getPropertyPath(),
                    $violation->getInvalidValue(),
                    $violation->getMessagePluralization(),
                    $violation->getCode()
                );

                $violations->add($extendedViolation);
            }
        }

        return $violations;
    }
protected function validateParams ( Validator $ validator , array $ params , ParameterBag $ values ) { $ violations = new ConstraintViolationList ( ) ; foreach ( $ params as $ param ) { if ( empty ( $ param [ 'requirements' ] ) ) { continue ; } $ value = $ values -> get ( $ param [ 'name' ] ) ; $ paramViolations = $ validator -> validateValue ( $ value , $ param [ 'requirements' ] ) ; // add missing data foreach ( $ paramViolations as $ violation ) { $ extendedViolation = new ConstraintViolation ( $ violation -> getMessage ( ) , $ violation -> getMessageTemplate ( ) , $ violation -> getMessageParameters ( ) , $ violation -> getRoot ( ) , $ param [ 'name' ] . $ violation -> getPropertyPath ( ) , $ violation -> getInvalidValue ( ) , $ violation -> getMessagePluralization ( ) , $ violation -> getCode ( ) ) ; $ violations -> add ( $ extendedViolation ) ; } } return $ violations ; }
Validate params.

@param \Symfony\Component\Validator\Validator         $validator
@param array                                          $params
@param \Symfony\Component\HttpFoundation\ParameterBag $values

@return \Symfony\Component\Validator\ConstraintViolationList
Validate params .