On 4/26/11 4:47 PM, winzou wrote:
Hi all,

I didn't manage to find an easy way to retrieve the current matched
route. I'm from an onCoreController listener, but the question is for
everywhere else.
The only way I found is that one :
$this->router->getRouteCollection()->get($event->getRequest()->attributes->get('_route'))

So I pass through the RouteCollection and the _route attribute of the
Request. Any easier solution ?

It's not possible. The Route object is not always available (never in production as a matter of fact). Why do you need the Route object?

Fabien

And actually I have another linked question. I want to retrieve the
_format requirement of the current route. But if I do a
$route->getRequirement('_format'), I retrieve a string like
'html|xml|css' instead of an array('html', 'xml', 'css'). Any other way
than doing an explode myself ?

Thanks.

--
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

--
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

Reply via email to