Use [#MapEntity()] attribute to inject entity into method + for now set controller_resolver.auto_mapping to true

This commit is contained in:
2025-05-28 14:58:59 +02:00
parent f282ffbfd4
commit 8ec18a6fb8
24 changed files with 120 additions and 117 deletions

View File

@@ -16,6 +16,7 @@ use Chill\EventBundle\Form\EventTypeType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class EventTypeController.
@@ -51,7 +52,7 @@ class EventTypeController extends AbstractController
/**
* Deletes a EventType entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])]
#[Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse
{
$form = $this->createDeleteForm($id);
@@ -75,7 +76,7 @@ class EventTypeController extends AbstractController
/**
* Displays a form to edit an existing EventType entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/edit', name: 'chill_eventtype_admin_edit')]
#[Route(path: '/{_locale}/admin/event/event_type/{id}/edit', name: 'chill_eventtype_admin_edit')]
public function editAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -99,7 +100,7 @@ class EventTypeController extends AbstractController
/**
* Lists all EventType entities.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/', name: 'chill_eventtype_admin', options: [null])]
#[Route(path: '/{_locale}/admin/event/event_type/', name: 'chill_eventtype_admin', options: [null])]
public function indexAction(): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -114,7 +115,7 @@ class EventTypeController extends AbstractController
/**
* Displays a form to create a new EventType entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/new', name: 'chill_eventtype_admin_new')]
#[Route(path: '/{_locale}/admin/event/event_type/new', name: 'chill_eventtype_admin_new')]
public function newAction(): \Symfony\Component\HttpFoundation\Response
{
$entity = new EventType();
@@ -129,7 +130,7 @@ class EventTypeController extends AbstractController
/**
* Finds and displays a EventType entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')]
#[Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')]
public function showAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -151,7 +152,7 @@ class EventTypeController extends AbstractController
/**
* Edits an existing EventType entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/update', name: 'chill_eventtype_admin_update', methods: ['POST', 'PUT'])]
#[Route(path: '/{_locale}/admin/event/event_type/{id}/update', name: 'chill_eventtype_admin_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -16,6 +16,7 @@ use Chill\EventBundle\Form\RoleType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class RoleController.
@@ -51,7 +52,7 @@ class RoleController extends AbstractController
/**
* Deletes a Role entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])]
#[Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse
{
$form = $this->createDeleteForm($id);
@@ -75,7 +76,7 @@ class RoleController extends AbstractController
/**
* Displays a form to edit an existing Role entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/edit', name: 'chill_event_admin_role_edit')]
#[Route(path: '/{_locale}/admin/event/role/{id}/edit', name: 'chill_event_admin_role_edit')]
public function editAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -99,7 +100,7 @@ class RoleController extends AbstractController
/**
* Lists all Role entities.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/', name: 'chill_event_admin_role', options: [null])]
#[Route(path: '/{_locale}/admin/event/role/', name: 'chill_event_admin_role', options: [null])]
public function indexAction(): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -114,7 +115,7 @@ class RoleController extends AbstractController
/**
* Displays a form to create a new Role entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/new', name: 'chill_event_admin_role_new')]
#[Route(path: '/{_locale}/admin/event/role/new', name: 'chill_event_admin_role_new')]
public function newAction(): \Symfony\Component\HttpFoundation\Response
{
$entity = new Role();
@@ -129,7 +130,7 @@ class RoleController extends AbstractController
/**
* Finds and displays a Role entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')]
#[Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')]
public function showAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -151,7 +152,7 @@ class RoleController extends AbstractController
/**
* Edits an existing Role entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/update', name: 'chill_event_admin_role_update', methods: ['POST', 'PUT'])]
#[Route(path: '/{_locale}/admin/event/role/{id}/update', name: 'chill_event_admin_role_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -16,6 +16,7 @@ use Chill\EventBundle\Form\StatusType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class StatusController.
@@ -51,7 +52,7 @@ class StatusController extends AbstractController
/**
* Deletes a Status entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])]
#[Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse
{
$form = $this->createDeleteForm($id);
@@ -75,7 +76,7 @@ class StatusController extends AbstractController
/**
* Displays a form to edit an existing Status entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/edit', name: 'chill_event_admin_status_edit')]
#[Route(path: '/{_locale}/admin/event/status/{id}/edit', name: 'chill_event_admin_status_edit')]
public function editAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -99,7 +100,7 @@ class StatusController extends AbstractController
/**
* Lists all Status entities.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/', name: 'chill_event_admin_status', options: [null])]
#[Route(path: '/{_locale}/admin/event/status/', name: 'chill_event_admin_status', options: [null])]
public function indexAction(): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -114,7 +115,7 @@ class StatusController extends AbstractController
/**
* Displays a form to create a new Status entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/new', name: 'chill_event_admin_status_new')]
#[Route(path: '/{_locale}/admin/event/status/new', name: 'chill_event_admin_status_new')]
public function newAction(): \Symfony\Component\HttpFoundation\Response
{
$entity = new Status();
@@ -129,7 +130,7 @@ class StatusController extends AbstractController
/**
* Finds and displays a Status entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')]
#[Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')]
public function showAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -151,7 +152,7 @@ class StatusController extends AbstractController
/**
* Edits an existing Status entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/update', name: 'chill_event_admin_status_update', methods: ['POST', 'PUT'])]
#[Route(path: '/{_locale}/admin/event/status/{id}/update', name: 'chill_event_admin_status_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();