On 4/1/11 3:09 AM, oscar balladares wrote:
Hi everybody, as I mentioned I think I found a bug in the Request component.
Before submitting the issue I need you to confirm or advice me if this
is really a bug and not a feature or misusing.
I resume, I have a main layout, which render a controller's response
template, in that template I want to show the current
route (app.request.attributes.get('_route')), but it will fail. If I try
to get the current controller instead
(app.request.attributes.get('_controller') it
will succeed. And if I 'include' the template instead 'render' the
controller (that returns the template as response) it will succeed also.
So seeing that everything else works fine, I'm pretty sure this is a
bug. But I need your opinion/advice to see if Im right.
This is not a bug. To have a route, you need to have matched an HTTP
URL. But when you render a controller directly, this does not happen.
That's why the _route attribute is empty. I will make a modification to
return '_internal' instead as this is actually the internal route used
by embedded controllers.
Fabien
I would want to report it to Symfony's trac system. This is the scenario:
I have a Layout.html.twig.
on In I have:
/**
Store/layout.html.twig
**/
{% render 'Store:Client:showMeTheCurrentRoute' %}
{% block content %}
{% endblock %}
<!-- content block doesn't play any role in the issue, I show it here
only for reading ease. -->
-----
The controller:
/**
Store/ClientController
**/
showMeTheCurrentRouteAction()
{
return $this->render('Store:Client:showMeTheCurrentRoute.html.twig');
}
------
The template:
/**
Store/Client/showMeTheCurrentRoute.html.twig
/**
{{ app.request.attributes.get('_route') }}
-------
On That scenario, the route won't be printed, (also no error, warning,
notice, nothing).
If I change '_route' by '_controller' it will print the current
controller. If I
use 'include' instead 'render', it will succeed:
/**
Store/layout.html.twig
**/
{% include 'Store:Client:showMeTheCurrentRoute.html.twig %}
--------
Hope you can tell me if this "IS" or "NOT" a bug
--
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