Symfony / Orocrm:未设置 yml 文件?
Symfony / Orocrm : yml file is not set?
网站:基于 Symfony 2.7 的开源框架
我的实体:Entity/Download.php(具有属性 "id"、"creation_date" 和 "name")
我正在开发我自己的 Bundle,我尝试基于我自己的实体创建一个新的数据网格,I follow this tutorial。以下是我所做的:
- 创建 /resources/config/datagrid.yml,使用非常轻的数据网格。
- 编辑 DependencyInjection/MyBundleExtension.php 加载 datagrid.yml.
- 编辑我的树枝视图以呈现数据网格:
{% import 'PimDataGridBundle::macros.html.twig' as dataGrid %}
{% block content %}
{{ dataGrid.renderGrid('custom_download', { localeCode: locale_code() }) }}
{% endblock %}
但是产生了这个错误:
Twig_Error_Runtime: "An exception has been thrown during the rendering
of a template ("A configuration for "custom_download" datagrid was not
found.
-> 如果我用另一个已经存在的网格名称尝试相同的代码,那么我相信问题出在我的新数据网格上,但我不明白出了什么问题:内核是否包含我的 YML 配置文件?我不这么认为。
感谢您的帮助。
您在 /resources/config 文件夹中创建 datagrid.yml。
但是根据 OroPlatform 约定,配置文件应该放在你的包的 Resources/config/oro 文件夹中,并命名为 datagrids.yml。
正是在这个路径中,OroPlatform 正在寻找数据网格配置。
https://github.com/oroinc/platform/blob/2.5/src/Oro/Bundle/DataGridBundle/Provider/ConfigurationProvider.php#L154-L160
请将您的配置移动到正确的目录和文件名中。这将是工作。当然,您应该删除从 DependencyInjection/MyBundleExtension.php OroPlatform 自动加载的文件。
要更详细地了解如何使用 OroPlatform 数据网格功能,请阅读捆绑文档
https://github.com/oroinc/platform/blob/2.5/src/Oro/Bundle/DataGridBundle/Resources/doc/backend/datagrid.md
网站:基于 Symfony 2.7 的开源框架 我的实体:Entity/Download.php(具有属性 "id"、"creation_date" 和 "name")
我正在开发我自己的 Bundle,我尝试基于我自己的实体创建一个新的数据网格,I follow this tutorial。以下是我所做的:
- 创建 /resources/config/datagrid.yml,使用非常轻的数据网格。
- 编辑 DependencyInjection/MyBundleExtension.php 加载 datagrid.yml.
- 编辑我的树枝视图以呈现数据网格:
{% import 'PimDataGridBundle::macros.html.twig' as dataGrid %}
{% block content %} {{ dataGrid.renderGrid('custom_download', { localeCode: locale_code() }) }}
{% endblock %}
但是产生了这个错误:
Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("A configuration for "custom_download" datagrid was not found.
-> 如果我用另一个已经存在的网格名称尝试相同的代码,那么我相信问题出在我的新数据网格上,但我不明白出了什么问题:内核是否包含我的 YML 配置文件?我不这么认为。
感谢您的帮助。
您在 /resources/config 文件夹中创建 datagrid.yml。 但是根据 OroPlatform 约定,配置文件应该放在你的包的 Resources/config/oro 文件夹中,并命名为 datagrids.yml。 正是在这个路径中,OroPlatform 正在寻找数据网格配置。 https://github.com/oroinc/platform/blob/2.5/src/Oro/Bundle/DataGridBundle/Provider/ConfigurationProvider.php#L154-L160
请将您的配置移动到正确的目录和文件名中。这将是工作。当然,您应该删除从 DependencyInjection/MyBundleExtension.php OroPlatform 自动加载的文件。
要更详细地了解如何使用 OroPlatform 数据网格功能,请阅读捆绑文档 https://github.com/oroinc/platform/blob/2.5/src/Oro/Bundle/DataGridBundle/Resources/doc/backend/datagrid.md