wip: extend model, admin crud

This commit is contained in:
Björn Fromme committed 2026-07-16 09:03:42 +02:00
1 parent 3ae30899ea
commit a294d1cc5e
38 files changed
+1240 -830

No files matched your search

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Controller\Admin\BookingEditDraft;
use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\BookingEditDraft;
use App\Htmx\HxRedirectResponse;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class DeleteController extends AbstractController
{
use ReturnUrlTrait;
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $adminLogger,
) {
}
#[Route('/admin/booking-edit-draft/{id}/delete', name: 'app_admin_bookingeditdraft_delete')]
public function index(BookingEditDraft $draft, Request $request): Response
{
if (true === $request->isMethod(Request::METHOD_POST)) {
$this->entityManager->remove($draft);
$this->entityManager->flush();
$this->adminLogger->info('Delete booking edit draft', [
'booking_number' => $draft->getBookingNumber(),
]);
$this->addFlash('success', 'Der Buchungsentwurf wurde gelöscht');
$returnUrl = $this->getReturnUrl($request, 'app_admin_bookingeditdraft');
return new HxRedirectResponse($returnUrl);
}
return $this->render('admin/booking_edit_draft/modal_delete.html.twig', [
'draft' => $draft,
]);
}
}