Reputation: 1884
I'm kind of new in Symfony2 Framework. This error take forever me to solved. I build my own project based from Jobeet tutorial. Now I've success till generate CRUD but when opening index page I got route error like this :
An exception has been thrown during the rendering of a template ("Parameter "id" for route "sifo_mst_periode_show" must match "[^/]++" ("" given) to generate a corresponding URL.") in SifoSchoolBundle:MstPeriode:index.html.twig at line 21.
This is my index.html.twig line 21 :
<td><a href="{{ path('sifo_mst_periode_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
This is the route :
sifo_mst_periode:
pattern: /
defaults: { _controller: "SifoSchoolBundle:MstPeriode:index" }
sifo_mst_periode_show:
pattern: /{id}/show
defaults: { _controller: "SifoSchoolBundle:MstPeriode:show" }
And this is the routing :
SifoSchoolBundle_sifo_mst_periode:
resource: "@SifoSchoolBundle/Resources/config/routing/mstperiode.yml"
prefix: /periode
Upvotes: 2
Views: 2319
Reputation: 1884
This Case has been solved. The problem is Primary Key (entity.id) had NULL Value which not show in Add Form. I make all Primary Key to auto and not handle by User Form.
Thank You.
Upvotes: 3