[英]symfony2 routing failed - cannot redeclare class
i'm trying to change my routing from annotations to thr routing.yml. 我正在尝试将我的路由从注释更改为thr routing.yml。 This is now the only configuration in my routing_dev.yml:
现在这是我的routing_dev.yml中的唯一配置:
user.index:
pattern: /
defaults: { _controller: AcmeMyBundle:User/UserIndex:index }
And this is the error: 这是错误:
Fatal error: Cannot redeclare class Acme\MyBundle\Controller\User\UserIndexController in C:\Users\gp\Desktop\xampp\htdocs\project\src\Acme\MyBundle\Controller\User\UserIndexController.php on line 56
Why does it happen? 为什么会发生? This is really the only class with this name.
这实际上是唯一使用此名称的类。 I have no annotations in the UserIndexController.
我在UserIndexController中没有注释。
Has anybody an idea? 有人知道吗? Thank you very much.
非常感谢你。
Try to grep/find in your project for Acme\\MyBundle\\Controller\\User\\UserIndexController
. 尝试在项目中grep /找到
Acme\\MyBundle\\Controller\\User\\UserIndexController
。
You maybe really have the class declared twice. 您可能真的已经将该类声明了两次。
Then, try to replace 然后,尝试更换
`AcmeMyBundle:User/UserIndex:index`
with AcmeMyBundle:User\\\\UserIndex:index
与
AcmeMyBundle:User\\\\UserIndex:index
Depending of the version of symfony, it will search for a "namespace like" and/or a "path like". 根据symfony的版本,它将搜索“名称空间”和/或“路径”。
这也发生了,这是我的控制器文件, 我的命名空间错误 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.