I have this routes file:
indexRechercheZones:
path: /gestionzonestechniques
defaults: { _controller: MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:indexZonesTechnique }
requirements:
methods: GET
modifierZones:
path: /gestionzonestechniques/modifier/{nom}
defaults: { _controller: MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:modifierZonesTechnique }
requirements:
methods: GET
modifierZones_process:
path: /gestionzonestechniques/modifier/process/{nom}
defaults: { _controller: MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:modifierZonesTechnique }
requirements:
methods: POST
Now when I want to proceed to the indexRechercheZones
route, an error occured:
An exception has been thrown during the rendering of a template
("Parameter "nom" for route "modifierZones" must match "[^/]++" (""
given) to generate a corresponding URL.") in
MySpaceGestion…sBundle:…:indexZonesTechniques.html.twig
at line 71.
In my twig line 71, I have this code:
<a href="{{ path('modifierZones', {'nom': zonetechnique.nom}) }}"><button class="btn btn-warning btn-xs">Modifier</button></a>
I think that is a regex problem, a problem with the url writing rule for symfony, but I don't how I can fix this error. I have tried some thing like adding this line in my route:
indexRechercheZones:
path: /gestionzonestechniques/
defaults: { _controller: MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:indexZonesTechnique }
requirements:
nom: \d+
methods: GET
or like this at the requirements:
requirements:
nom: '[a-zA-Z0-9-_\/-\s.^]+'
But it does not match. Someone could help?
Thank you…
Best Solution
Like @Coussinsky said, some
values
for yourfield
"nom" are empty on your database.You could make this parameter to
null
if you want, or just change the empty values on your database.