【问题标题】:Use routing and controllers from another bundle on Symfony2在 Symfony2 上使用来自另一个包的路由和控制器
【发布时间】:2016-08-01 22:33:33
【问题描述】:

我正在使用我构建的自定义捆绑包,并且我已经安装了 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 中? 提前谢谢!

【问题讨论】:

    标签: symfony entity bundle symfony-routing


    【解决方案1】:

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

    【讨论】:

    • 非常感谢!看起来一切都很好,除了我的错字。
    猜你喜欢
    • 1970-01-01
    • 2016-03-30
    • 2013-07-24
    • 2012-10-13
    • 2017-11-18
    • 1970-01-01
    • 2014-09-16
    • 2014-03-28
    • 1970-01-01
    相关资源
    最近更新 更多