Use SensioFrameworkExtraBundle and Web Debug Toolbar in Symfony2
I am using the SensioFrameworkExtraBundle located here http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html to allow for routes and template information to be placed directly above controller actions like:
/**
* @Route("/")
* @Template()
*/
public function indexAction($name = 'test'){
return array('name' => $name);
}
This causes t开发者_开发问答he framework to pass the returned array to a template located in the views folder with the name index.html.twig.
It also prevents the need to include the Response
class in your controller.
The trouble is, this also prevents the web debug toolbar
from displaying.
Is there anyway to use the SensioFrameworkExtraBundle in this manner and still have the web debug toolbar display?
I don't think it's the annotation that's the problem. Is your view extending app/Resources/base.html.twig (or .php)? I've seen that when my views don't extend the base I don't see the web debug toolbar.
The web debug toolbar is placed just before the </body>
.
So you can use twig
, Response
or anything you want, if the final HTML has <body></body>
then the web debug toolbar will be automatically placed.
Hope this helps.
精彩评论