protected function prepareDeleteResource(ResourceInterface $resource, $autoCommit, $hasError, $hasFlushError)
    {
        $continue = false;

        if (!$autoCommit && $hasError) {
            $resource->setStatus(ResourceStatutes::CANCELED);
            $continue = true;
        } elseif ($autoCommit && $hasFlushError && $hasError) {
            DomainUtil::addResourceError($resource, $this->translator->trans('domain.database_previous_error', [], 'FxpResource'));
            $continue = true;
        } elseif (null !== $idError = $this->getErrorIdentifier($resource->getRealData(), static::TYPE_DELETE)) {
            $hasError = true;
            $resource->setStatus(ResourceStatutes::ERROR);
            $resource->getErrors()->add(new ConstraintViolation($idError, $idError, [], $resource->getRealData(), null, null));
            $continue = true;
        }

        return [$continue, $hasError];
    }