Bundle https://github.com/saadtazi/SaadTaziGChartBundle(版本2.0)传递" twig.form.resources"作为一个论点。
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="twig.extension.g_chart.class">SaadTazi\GChartBundle\Twig\GChartExtension</parameter>
<parameter key="twig.extension.visualization.template">SaadTaziGChartBundle:chart:visualizationChart.html.twig</parameter>
</parameters>
<services>
<service id="twig.extension.g_chart" class="%twig.extension.g_chart.class%">
<tag name="twig.extension" alias="g_chart" />
<argument key="twig.form.resources" type="collection">
<argument key="gChartTemplate">%twig.extension.visualization.template%</argument>
</argument>
</service>
</services>
</container>
此配置在Syfony 3.3中抛出异常:
Invalid key "twig.form.resources" found in arguments of method "__construct()" for service "twig.extension.g_chart": only integer or $named arguments are allowed.
构造函数有一个resources属性:
/**
* @param array $resources a list of resources (see Resources/g_chart.xml)
*/
public function __construct(array $resources = array()) {
$this->resources = $resources;
}
我尝试通过传递&#34; twig.form_themes&#34;来修复它,这是&#34; twig.form.resources&#34;的替代品,但是它也引发了一个例外。感谢任何想法,谢谢!