Symfony3.4 Deprecations: User Deprecated: Calling ..在模板上…&qu



我在Symfony 3.4中得到了以下已弃用的消息。
我调查了这个错误,但解决方案是包括{% import "..." as macros %}.
然而,我已经把它,我不知道如何解决它。
有解决办法吗?

消息

User Deprecated: Calling "articleSearch" on template "AppAhiSpAdminBundle::adminmacros.html.twig" from template
"AppAhiSpAdminBundle:Hq/Article:index.html.twig" is deprecated since version 1.28
and won't be supported anymore in 2.0.

index.html.twig

{% extends 'AppAhiSpAdminBundle::hq_layout.html.twig' %}
<div class="search">
{{ macros.articleSearch(searchForm) }}
</div>

hq_layout.html.twig

{% extends '::base.html.twig' %}
{% import "AppAhiSpAdminBundle::adminmacros.html.twig" as macros %}

adminmacros.html.twig

{% macro articleSearch(searchForm) %}
{% endmacro %}

您需要在每个想要使用宏的单独模板中导入宏

看文档

相关内容

  • 没有找到相关文章

最新更新