I am learning Symfony and I'm working with the following URI:
url_for('newItem/show?id='.$item->getId().'&name='.$item->getName().'&summary='.$item->getSummary())
With the below routing.yml
item_show_user:
url: /newItem/:name/:summary
param: {module: newItem, action: show}
# default rules
homepage:
url: /
param: { module: newItem, action: index }
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/*
Based on the parameters of the URI the route it should use is 'item_show_user', is this correct? Instead I开发者_运维技巧 am getting a 404 error.
Strangely if I change all instances of summary, to model (another column in my database) the route works absolutely fine. How can this be?
Furthermore when the URL does work (e.g. using model) the URL should display as:
/newItem/Name/Model
Instead it shows up as:
/newItem/Name/Model/?id=
Can you help me there also?
item_show_user:
url: /newItem/:name/:summary/:id
param: {module: newItem, action: show}
You need to put the id param on your route if you want to use item_show_user route.
精彩评论