43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Admin\Application;
|
|
|
|
use App\Entity\Application;
|
|
use App\Entity\Disposition;
|
|
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 DisposeController extends AbstractController
|
|
{
|
|
public function __construct(
|
|
private readonly EntityManagerInterface $entityManager,
|
|
private readonly LoggerInterface $logger
|
|
) {
|
|
}
|
|
|
|
#[Route('/admin/application/dispose/{uuid}', name: 'app_admin_application_dispose')]
|
|
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
|
#[IsGranted('DISPOSE', subject: 'application')]
|
|
public function index(Application $application): Response
|
|
{
|
|
$disposition = new Disposition($application);
|
|
|
|
$this->entityManager->persist($disposition);
|
|
$this->entityManager->remove($application);
|
|
$this->entityManager->flush();
|
|
|
|
$this->addFlash('success', 'Der Teamer wurde eingeteilt');
|
|
$this->logger->info('Create disposition', [
|
|
'disposition_id' => $disposition->getId(),
|
|
'teamer' => (string) $application->getTeamer(),
|
|
]);
|
|
|
|
return $this->redirectToRoute('app_admin_assignment_detail', [
|
|
'uuid' => $application->getAssignment()->getUuid(),
|
|
]);
|
|
}
|
|
} |