I wish to enable variables to be added to the URL for a route in Symfony2 ie.
www.mysymfonyproject.com/blog/1?style=fresh&rpp=5
The documentation talks about generating urls with query, but from what I understand this is for dynamic content in the app?:
$router->generate('blog', array('page' => 2, 'category' => 'Symfony'));
// /blog/2?category=Symfony
What I would like would be this:
_blogList:
pattern: /blog/{page}?{query}
defaults: { _controller: TestBundle:Blog:view ,page:1, query: NULL }
But obviously that doesn’t work.
Can this be done using YAML? Or do I need to switch my config.yml to PHP?
Thanks.
Can you try this route (it should work) :
Then to generate an url like
/blog/1?style=fresh&rpp=5, use:or