diff --git a/src/Resources/skeleton/crud/controller/Controller.tpl.php b/src/Resources/skeleton/crud/controller/Controller.tpl.php index 69a15df3a..012ce710f 100644 --- a/src/Resources/skeleton/crud/controller/Controller.tpl.php +++ b/src/Resources/skeleton/crud/controller/Controller.tpl.php @@ -77,7 +77,7 @@ public function edit(Request $request, $generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?> public function delete(Request $request, $, EntityManagerInterface $entityManager): Response { - if ($this->isCsrfTokenValid('delete'.$->get(), $request->getPayload()->get('_token'))) { + if ($this->isCsrfTokenValid('delete'.$->get(), $request->getPayload()->getString('_token'))) { $entityManager->remove($); $entityManager->flush(); } diff --git a/tests/fixtures/make-crud/expected/WithCustomRepository.php b/tests/fixtures/make-crud/expected/WithCustomRepository.php index 88d73cf88..390c94bf8 100644 --- a/tests/fixtures/make-crud/expected/WithCustomRepository.php +++ b/tests/fixtures/make-crud/expected/WithCustomRepository.php @@ -71,7 +71,7 @@ public function edit(Request $request, SweetFood $sweetFood, EntityManagerInterf #[Route('/{id}', name: 'app_sweet_food_delete', methods: ['POST'])] public function delete(Request $request, SweetFood $sweetFood, EntityManagerInterface $entityManager): Response { - if ($this->isCsrfTokenValid('delete'.$sweetFood->getId(), $request->getPayload()->get('_token'))) { + if ($this->isCsrfTokenValid('delete'.$sweetFood->getId(), $request->getPayload()->getString('_token'))) { $entityManager->remove($sweetFood); $entityManager->flush(); }