How to deactivate some symfony2 debug toolbar elements?

前端 未结 2 636
情深已故
情深已故 2021-01-15 04:45

I am using symfony2 and its debug toolbar is great.

However, I\'ve come to install som extra bundles which add some elements and it is now displayed on two levels.

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 04:59

    I had issue with php-cache. It had CacheDataCollector which could crash symfony2 in some cases - https://github.com/php-cache/issues/issues/112 I tried solution above (with priority 0) - and it doesnt worked, data-collector still crashed symfony2

    I dont have any ideas why priority = 0 should disable anything. You could check symfony2 ProfilerPass yourself, which process tag data_collector in https://github.com/avorobiev/symfony2/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php

    So, I have used pretty dirty patch intead - in application config I add service with the same name, but without tag data_collector. Like

    services:
      cache.data_collector:
        class: Cache\CacheBundle\DataCollector\CacheDataCollector
    

    More clean and more stable way would be adding CompilerPass, which will remove tag - https://blog.liplex.de/disable-elements-in-the-symfony-developer-toolbar-with-compilerpass/

提交回复
热议问题