Le 21/05/2011 12:23, Michael Piecko a écrit :
Could someone please help me understanding the routing, especially
with optional GET parameters.
I have a route:
_debug:
pattern: /debug
defaults: { _controller: MyXBundle:Default:debug }
My Controller:
public function debugAction($id = 100)
{
/// Do something with $id/
...
}
When i request this controller with http://.../debug?id=500 i expect
to have an $id = 500 inside my action. But no, $id is still 100. Is
this the expected behaviour? Do i have always to use
$this->get('request')->get('id') to get any GET parameters?
the parameters passed to an action are routing placeholders, not GET
parameters. To access GET parameters, you need to use the Request object:
$id = $this->get('request')->request->get('id')
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en