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
现在,当我想继续使用indexRechercheZones路由时,发生错误:
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.
<a href="{{ path('modifierZones', {'nom': zonetechnique.nom}) }}"><button class="btn btn-warning btn-xs">Modifier</button></a>
我认为这是一个正则表达式问题,symfony的url编写规则存在问题,但我不知道如何修复此错误.我尝试过在我的路线中添加这一行的一些事情:
indexRechercheZones:
path: /gestionzonestechniques/
defaults: { _controller: myspaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:indexZonesTechnique }
requirements:
nom: \d+
methods: GET
或者像这样要求:
requirements:
nom: '[a-zA-Z0-9-_\/-\s.^]+'
但它不匹配.有人可以帮忙吗?
谢谢…
解决方法:
就像@Coussinsky所说,你的字段“nom”的某些值在你的数据库中是空的.
如果需要,可以将此参数设置为null,或者只更改数据库中的空值.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。