Repository/DoctrineConfigRepository.php
protected function validate($entity, array $groups = null)
    {
        $errors = $this->validator->validate($entity, $groups);
        if (count($errors) != 0) {
            throw new InvalidArgumentException((string)$errors);
        }
        return $entity;
    }
protected function validate($entity, array $groups = null)
    {
        $errors = $this->validator->validate($entity, $groups);
        if (count($errors) != 0) {
            throw new InvalidArgumentException((string)$errors);
        }
        return $entity;
    }
@param object     $entity
@param array|null $groups The validation groups to validate.

@throws InvalidArgumentException if $entity is invalid
@return object $entity