public function validate($entity, $constraints = null, $groups = null)
    {
        if (!is_object($entity)) {
            throw new InvalidArgumentException('validator has no valid entity');
        }

        $result = array();
        $violations = $this->getHandler()->validate($entity, $constraints, $groups);

        /**
         * @var \Symfony\Component\Validator\ConstraintViolationInterface $violation
         */
        foreach ($violations as $violation) {
            $propertyName = Utility::normilizeName($violation->getPropertyPath());

            $result[] = new Violation($propertyName, $violation->getInvalidValue(), $violation->getMessage());
        }

        return $result;
    }
public function validate($entity, $constraints = null, $groups = null)
    {
        if (!is_object($entity)) {
            throw new InvalidArgumentException('validator has no valid entity');
        }

        $result = array();
        $violations = $this->getHandler()->validate($entity, $constraints, $groups);

        /**
         * @var \Symfony\Component\Validator\ConstraintViolationInterface $violation
         */
        foreach ($violations as $violation) {
            $propertyName = Utility::normilizeName($violation->getPropertyPath());

            $result[] = new Violation($propertyName, $violation->getInvalidValue(), $violation->getMessage());
        }

        return $result;
    }
public function validate ( $ entity , $ constraints = null , $ groups = null ) { if ( ! is_object ( $ entity ) ) { throw new InvalidArgumentException ( 'validator has no valid entity' ) ; } $ result = array ( ) ; $ violations = $ this -> getHandler ( ) -> validate ( $ entity , $ constraints , $ groups ) ; /**
         * @var \Symfony\Component\Validator\ConstraintViolationInterface $violation
         */ foreach ( $ violations as $ violation ) { $ propertyName = Utility :: normilizeName ( $ violation -> getPropertyPath ( ) ) ; $ result [ ] = new Violation ( $ propertyName , $ violation -> getInvalidValue ( ) , $ violation -> getMessage ( ) ) ; } return $ result ; }
validate a given entity

a entity is validated. Violations are wrapped in a instance of ViolationInterface

@param object $entity
@param array|null $constraints
@param array|null $groups
@return array    array of violations, wrapped in a instance of ViolationInterface
validate a given entity