Category : parameters

I’m generating a path to my controller in a twig template with the path function, and adding additional parameters. the first parameter comes in fine but the other parameters have amp; added to their names. this is the twig statement: location.href = "{{ path(‘export_report’, { ‘fileId’: ‘datatable_export_excel’, ‘country’: ‘eu’, ‘countries’: [‘BE, NL’] }) }}"; with ..

Read more

I’m encountering a strange problem when calling create form method in symfony 5.1. The code failing : namespace AppController; use AppEntityDocumentsventehabitation; use AppFormDocumentsventehabitationType; use AppEntityUserDocuments; use AppEntityDocumentscontratdetravail; use AppFormDocumentscontratdetravailType; public function fillDocument(DocumentsRepository $docRepo, Request $request, int $id) { $currentDoc = $docRepo->findBy(["id" => $id]); $name = $currentDoc[0]->getDocModelName(); $docEntity= str_replace("_", "", $name); $formEntity = $docEntity."Type::class"; $docEntity = ..

Read more

J’ai voulu mettre dans mon controller un deuxième boutton delete pour supprimer des commentaires mais j’ai eu plein de messages d’erreurs comme celui de ParamConverter car il ne reconnaissait pas la class. Donc dans mon controller j’ai une ParamConverter comme ça: /** * @Route("/delete/{comment_id}", name="comment_delete", methods={"DELETE"}) * @ParamConverter("comment", class="App:Comment", options={"id": "id"}) */ public function deleteComment(Request ..

Read more

in my Symfony 5 project, in several Twig files, I’ve to use a form_theme, like this : {% form_theme form ‘app/partials/themes/fields.html.twig’ %} But I would like to pass a parameter (different for all templates where I’m using the form_theme) to this form_theme. Is there a solution ? Something like {% form_theme form ‘app/partials/themes/fields.html.twig’ with {‘paramName’: ..

Read more

(Sorry for my english) I’m making a subscribe system (the flush is ok in database) than: return $this->redirectToRoute(‘organize_home’,); My Route of redirection needs an Id /** * @Route("/mon-compte/{id}", name="organize_home") */ public function accountHomepage(User $user) { return $this->render(‘user/organize_home.html.twig’); } How can I send this id to the redirection ? I tried to play with the user ..

Read more