diff --git a/src/Controller/VocabFuncContextController.php b/src/Controller/VocabFuncContextController.php index b323c2c..50c7c22 100644 --- a/src/Controller/VocabFuncContextController.php +++ b/src/Controller/VocabFuncContextController.php @@ -54,6 +54,23 @@ class VocabFuncContextController extends AbstractController return $this->redirectToRoute('app_vocab_func_context'); } + #[Route('/vocabs/functional_context/update', name: 'app_vocab_func_context_upd')] + public function updateTerm(Request $request, EntityManagerInterface $em): Response + { + $id = $request->getPayload()->get('_id'); + $newTerm = $request->getPayload()->get('_new_term'); + + $repo = $em->getRepository(VocabFuncContext::class); + $vocab = $repo->find($id); + $vocab->setTerm($newTerm); + $em->flush(); + + $this->addFlash('notice', 'Term updated successfully'); + + return $this->redirectToRoute('app_vocab_func_context'); + } + + #[Route('/vocabs/functional_context/del', name: 'app_vocab_func_context_del')] public function deleteTerm(Request $request, EntityManagerInterface $em): Response { diff --git a/templates/vocab_func_context/index.html.twig b/templates/vocab_func_context/index.html.twig index 564e8f0..7c8cb74 100644 --- a/templates/vocab_func_context/index.html.twig +++ b/templates/vocab_func_context/index.html.twig @@ -48,6 +48,12 @@ {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
+