I'm using fos userbundle to create pages for the route /profile
. Now I want to be able to see other users profiles too so I created my own controller generating /profile/{username}
.
The problem I'm having now is that I can't use the fos userbundle path /profile/edit
. It does show the path in route:debug
Is there any way to make an exception for the route /profile/edit?
here's my controller:
/**
* @Route("/profile/{username}")
* @Template()
* @Security("has_role('ROLE_USER')")
*/
public function showOtherAction($username){
$em = $this->get('doctrine')->getManager();
$user = $em->getRepository('DigitalArtLabBundle:User')->findOneByUsername($username);
$sessions = $em->getRepository('DigitalArtLabBundle:checkin')->findLastSessions($user->getUsername() );
return $this->render('FOSUserBundle:Profile:show.html.twig', array(
'user' => $user,
'ses' => $sessions
));
}
thank's ahead :)
You should paste your routing configuration for that route after including routing configuration from FOSUserBundle
. And then the first matched route (from FOSUserBundle
) will be used.
Example routing.yml
for your case:
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
app:
resource: "@AppBundle/Controller/"
type: annotation
Be aware: you can't have user with name "edit" (and other reserved route paths) in this case.