mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-06 05:19:43 +00:00
Use [#MapEntity()] attribute to inject entity into method + for now set controller_resolver.auto_mapping to true
This commit is contained in:
@@ -24,6 +24,7 @@ use Chill\MainBundle\Security\Authorization\NotificationVoter;
|
||||
use Chill\MainBundle\Security\ChillSecurity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -99,7 +100,7 @@ class NotificationController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route(path: '/{id}/edit', name: 'chill_main_notification_edit')]
|
||||
public function editAction(Notification $notification, Request $request): Response
|
||||
public function editAction(#[MapEntity(id: 'id')] Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_UPDATE, $notification);
|
||||
|
||||
@@ -127,7 +128,7 @@ class NotificationController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route(path: '/{id}/access_key', name: 'chill_main_notification_grant_access_by_access_key')]
|
||||
public function getAccessByAccessKey(Notification $notification, Request $request): Response
|
||||
public function getAccessByAccessKey(#[MapEntity(id: 'id')] Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
|
||||
@@ -215,7 +216,7 @@ class NotificationController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route(path: '/{id}/show', name: 'chill_main_notification_show')]
|
||||
public function showAction(Notification $notification, Request $request): Response
|
||||
public function showAction(#[MapEntity(id: 'id')] Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_SEE, $notification);
|
||||
|
||||
|
Reference in New Issue
Block a user