WIP Impelement more stuff

This commit is contained in:
Björn Fromme
2023-10-04 15:10:16 +02:00
parent dec8feedf2
commit cc1ab396af
35 changed files with 928 additions and 177 deletions
@@ -0,0 +1,37 @@
<?php
namespace App\Controller\Admin\Teamer\TrainingAttendance;
use App\Entity\TrainingAttendance;
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/teamer/skills/training-attendance/delete/{uuid}', name: 'app_admin_teamer_skills_training_attendance_delete', methods: ['POST'])]
#[IsGranted('ROLE_ADMIN')]
public function index(TrainingAttendance $attendance): Response
{
$teamer = $attendance->getTeamer();
$this->entityManager->remove($attendance);
$this->entityManager->flush();
$this->addFlash('success', 'Die Teilnahme an der Fortbilundg wurde gelöscht');
$this->logger->info('Delete training attendance', [
'teamer' => $teamer->getUuid(),
]);
return $this->redirectToRoute('app_admin_teamer_skills', ['uuid' => $teamer->getUuid()]);
}
}