assetic.ERROR “DoctrineBundle:Collector:db.html.twig” contains an error: Unknown “profiler_dump” function

我们两清 提交于 2019-12-01 18:14:53

By default, AsseticBundle will try to handle the templates of all enabled bundles which leads to errors when enabled bundles ship with templates that rely on features not being loaded in the prod environment. You can solve your issue by explicitly listing all bundles that should be handled by Assetic using the assetic.bundles option.

profiler_dump method comes from Symfony's WebProfilerBundle. This bundle is not applied to Kernel in production mode, and it should not be (WebProfiler toolbar should be enabled only during development). You should remove those calls from twig template.

I've solved this by creating twig extension defining empty function profiler_dump and loading this twig extension only in production.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!