在 Symfony2 上使用来自另一个包的路由和控制器

Use routing and controllers from another bundle on Symfony2

我正在使用自己构建的自定义捆绑包,并且我已经安装了 FOSUserBundle。 在我的包中,我有 UserEntity,它有它的控制器,它的路由前缀是:/admin/user。我希望路由 admin_user_showFOSUserBundle:Profile:show

获取操作

这是 routing.yml

的代码
admin_user_show:
path:     /{id}/show
defaults: { _controller: "CMSBundle:User:show" }
methods:  GET

我改成这个但是我得到一个错误:

fos_user_profile_show:
path:     /{id}/show
defaults: { _controller: "FOSUSerBundle:Profile:show" }
methods:  GET

这是我得到的错误:

The "FOSUSerBundle" (from the _controller value "FOSUSerBundle:Profile:show") does not exist or is not enabled in your kernel! Did you mean "FOSUserBundle:Profile:show"?

如何将 FOSUserBundle 包含到我的 Bundle 中? 提前致谢!

在我看来,您的路由有错别字: FOSUSerBundle:Profile:show 而不是 FOSUserBundle:Profile:show (请注意,在您的情况下,User 中的 S 是大写的)