Search code examples
symfonyentitybundlesymfony-routing

Use routing and controllers from another bundle on Symfony2


I am using a Custom Bundle built by me and I have installed FOSUserBundle. Inside my bundle I have UserEntity which has its Controller and it's routing with the prefix: /admin/user. I want the route admin_user_show to get the action from the FOSUserBundle:Profile:show

This is the code to routing.yml

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

I change it to this but I get an error:

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

This is the error I 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"?

How can I include FOSUserBundle into my Bundle? Thank you in advance!


Solution

  • It seems to me that you have a typo in your routing: FOSUSerBundle:Profile:show instead of FOSUserBundle:Profile:show (note that in your case the S in User is capital)