WIP: Implement teamer document upload handling

This commit is contained in:
Björn Fromme
2023-10-12 19:50:08 +02:00
parent bfd18b21ce
commit 6df725edc4
25 changed files with 611 additions and 165 deletions
@@ -1,36 +0,0 @@
<?php
namespace App\Controller\Admin\Document;
use App\Entity\Upload;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class DeleteController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $logger
) {
}
#[Route('/admin/document/delete/{uuid}', name: 'app_admin_document_delete')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('DELETE', subject: 'document')]
public function index(Upload $document): Response
{
$this->entityManager->remove($document);
$this->entityManager->flush();
$this->addFlash('success', 'Das Dokument wurde gelöscht');
$this->logger->info('Delete document', [
'document' => $document->getOriginalFilename(),
]);
return $this->redirectToRoute('app_admin_document_index');
}
}