code: protected function validate($entity, array $groups = null)
      {
          $errors = $this->validator->validate($entity, $groups);
          if (count($errors) != 0) {
              throw new InvalidArgumentException((string)$errors);
          }
          return $entity;
      }
docs: @param object     $entity
  @param array|null $groups The validation groups to validate.
  
  @throws InvalidArgumentException if $entity is invalid
  @return object $entity