36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Admin\System\Fee;
|
|
|
|
use App\Entity\Fee;
|
|
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/system/fee/delete/{id}', name: 'app_admin_system_fee_delete', methods: ['POST'])]
|
|
#[IsGranted('ROLE_ADMIN')]
|
|
public function index(Fee $fee): Response
|
|
{
|
|
$fee->setDeleted();
|
|
$this->entityManager->flush();
|
|
|
|
$this->addFlash('success', 'Das Honorar wurde gelöscht');
|
|
$this->logger->info('Delete fee', [
|
|
'fee_id' => $fee->getId(),
|
|
'fee_name' => $fee->getNameInternal() ?? $fee->getName(),
|
|
]);
|
|
|
|
return $this->redirectToRoute('app_admin_system_fee_index');
|
|
}
|
|
} |