I have a Symfony event listener which is listening on "kernel.request". I would like to add an attribute to the request which I can access in my controllers. I tried doing this:
$request = $event->getRequest();
$request->attributes->set('test', 'testvalue');
However, the "test" attribute is not a part of the request object in my controllers. I am not receiving any errors, but it's just not there. What else do I need to do?
edit:
I verified that the listener is being called. In my controller, I have this, but don't get the "test" attribute:
class DefaultController extends BaseController
{
public function indexAction(Request $request)
{
echo "<pre>"; print_r($request->attributes); echo "</pre>";
}
}