feat: feature flags for sanitizing and stamping of uploads

This commit is contained in:
Björn Fromme
2025-03-18 18:14:25 +01:00
parent 3ad8b59ba1
commit ca8997ab19
7 changed files with 178 additions and 10 deletions
@@ -11,6 +11,7 @@ use App\Form\TeamerDispositionType;
use App\Model\UploadSessionDto;
use App\Service\Upload\UploadHandler;
use Doctrine\ORM\EntityManagerInterface;
use Flagception\Manager\FeatureManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Target;
@@ -31,7 +32,8 @@ class DetailController extends AbstractController
#[Target('disposition')]
private readonly WorkflowInterface $workflow,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly LoggerInterface $logger
private readonly LoggerInterface $logger,
private readonly FeatureManagerInterface $featureManager,
) {
}
@@ -88,7 +90,10 @@ class DetailController extends AbstractController
$this->uploadHandler->moveUploadSessionFilesFromOrphanage(Upload::TYPE_CONTRACT, $uploadSession);
$this->uploadHandler->destroyUploadSession();
$this->uploadHandler->ensurePdf($upload);
if (true === $this->featureManager->isActive('sanitize_uploads')) {
$this->uploadHandler->ensurePdf($upload);
}
$this->entityManager->flush();
@@ -118,7 +123,10 @@ class DetailController extends AbstractController
$this->uploadHandler->moveUploadSessionFilesFromOrphanage(Upload::TYPE_INVOICE, $uploadSession);
$this->uploadHandler->destroyUploadSession();
$this->uploadHandler->ensurePdf($upload);
if (true === $this->featureManager->isActive('sanitize_uploads')) {
$this->uploadHandler->ensurePdf($upload);
}
$this->entityManager->flush();