protected function flushTransactionException(\Exception $e, ConstraintViolationListInterface $violations, $object = null): void
    {
        if (null !== $this->connection && null === $object) {
            $this->connection->rollback();
        }

        if ($e instanceof ConstraintViolationException) {
            $violations->addAll($e->getConstraintViolations());
        } else {
            $message = DomainUtil::getExceptionMessage($this->translator, $e, $this->debug);

            $violations->add(new ConstraintViolation($message, $message, [], $object, null, null));
        }
    }