WIP: Implement CRUD, improve menu configuration

This commit is contained in:
Björn Fromme
2023-09-27 17:50:42 +02:00
parent c55fd85314
commit c528156959
43 changed files with 2187 additions and 3475 deletions
@@ -0,0 +1,45 @@
<?php
namespace App\Controller\Admin\System\JobProfile;
use App\Entity\JobProfile;
use App\Form\JobProfileType;
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\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class EditController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $logger
) {
}
#[Route('/admin/system/job-profile/edit/{id}', name: 'app_admin_system_job_profile_edit')]
#[IsGranted('ROLE_ADMIN')]
public function index(JobProfile $jobProfile, Request $request): Response
{
$form = $this->createForm(JobProfileType::class, $jobProfile);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->entityManager->flush();
$this->addFlash('success', 'Das Job-Profil wurde aktualisiert');
$this->logger->info('Edit Job profile', [
'job_profile' => $jobProfile->getName(),
]);
return $this->redirectToRoute('app_admin_system_job_profile_index');
}
return $this->render('admin/system/job_profile/edit.html.twig', [
'form' => $form
]);
}
}