Symfony - 安装 FOSJsRoutingBundle(编译器错误)
Symfony - Installing FOSJsRoutingBundle (Compiler Error)
我正在尝试安装 FOSJsRoutingBundle。我遵循了文档 here。但出于某种原因,我收到此错误:
Compile Error: Label 'not_fos_js_routing_js' already defined
Stack Trace in var\cache\dev\FooUrlMatcherGenerator.php
> return $this->mergeDefaults(array_replace($matches, array('_route' => 'fos_js_routing_js', '_site' => '2')), array (
> '_controller' => 'fos_js_routing.controller:indexAction', '_format'
> => 'js',));
> }
> not_fos_js_routing_js:
我以多种方式(手动和使用命令)清除了所有缓存。我安装了资产...等但结果仍然相同。
生根
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
布局(javascript块)
{% javascripts '@fooBundle/Resources/public/js/jquery-3.2.1.min.js'
'@fooBundle/Resources/public/js/bootstrap.min.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' })
我的 javascript 脚本使用的地方:
var url= Routing.generate('foo_rout_that_exsists', { id: 3 }, true);
alert(url);
config.yml
fos_js_routing:
routes_to_expose: [ "[a-zA-z0-9_-]+" ]
也可以参考symfony官方文档
我正在尝试安装 FOSJsRoutingBundle。我遵循了文档 here。但出于某种原因,我收到此错误:
Compile Error: Label 'not_fos_js_routing_js' already defined
Stack Trace in var\cache\dev\FooUrlMatcherGenerator.php
> return $this->mergeDefaults(array_replace($matches, array('_route' => 'fos_js_routing_js', '_site' => '2')), array (
> '_controller' => 'fos_js_routing.controller:indexAction', '_format'
> => 'js',));
> }
> not_fos_js_routing_js:
我以多种方式(手动和使用命令)清除了所有缓存。我安装了资产...等但结果仍然相同。 生根
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
布局(javascript块)
{% javascripts '@fooBundle/Resources/public/js/jquery-3.2.1.min.js'
'@fooBundle/Resources/public/js/bootstrap.min.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' })
我的 javascript 脚本使用的地方:
var url= Routing.generate('foo_rout_that_exsists', { id: 3 }, true);
alert(url);
config.yml
fos_js_routing:
routes_to_expose: [ "[a-zA-z0-9_-]+" ]
也可以参考symfony官方文档