Sonata Admin 搜索块给出以下错误

Sonata Admin seach block give the following error

我尝试使用 Sonata admin 中的搜索块:

在呈现模板 ("Class does not exist") 期间抛出异常。

以及这些错误: }, { 'query': 查询, 'admin_code': admin.code, 'page': 0, 'per_page': 10, 'icon': group.icon }) }} {% endif %} {% endfor %} {% endif %} {% endfor %}

当某些 Bundle 不存在实体时会显示此问题,我指的是没有实体的 Bundle。 我通过在 search.html.twig:

中转义这些 Bundle 解决了这个问题
{% if admin.code!= 'bundle.admin.bulkcoupon' and  admin.code!='bundle.admin.tools' %}
                        {{ sonata_block_render({
                            'type': 'sonata.admin.block.search_result'
                        }, {
                            'query': query,
                            'admin_code': admin.code,
                            'page': 0,
                            'per_page': 10,
                            'icon': group.icon
                        }) }}
        {% endif %}