问题描述
上下文
我正在尝试为自定义实体网格构建自定义 html 列。我已在 Oro 平台核心中搜索以找到 datagrids.yml
columns:
id:
label: ID
frontend_type: integer
name:
label: app.vehicule_type.fields.name
logo:
label: app.vehicule_type.fields.logo
type: twig
frontend_type: html
template: BaltimoreAppBundle:Attachment:Datagrid/Property/image.html.twig
BaltimoreAppBundle
是我的包名称,image.html.twig
是自定义模板文件。
问题
OroPlatform/Symfony 无法理解我的包别名 BaltimoreAppBundle
,所以我遇到了错误。
知道为什么我的别名不起作用吗?
谢谢。
解决方法
首先,通过运行以下命令确保捆绑包已在 symfony 内核中注册:
php bin/console debug:container --parameter=kernel.bundles --format=json
输出数组中的键是应该用于模板路径的包名称。 如果不是,请按照 Bundle Creation Guide。
然后确保您引用的模板路径正确。对于您使用的那个,在加载的 BaltimoreAppBundle 包中,您应该有模板文件路径:Resources/views/Attachment/Datagrid/Property/image.html.twig
。
如果没有帮助,请使用 rm -rf var/cache/*
删除应用程序缓存,然后使用 php bin/console cache:warmup
手动重新生成,以确保应用程序缓存是最新的。