So basically I have a controller of a bundle in which i want to and a route prefix so i use the @Route annotation on the class, i've done this all of the other controllers of my Symfony2 app. However this one does not take the prefix into account so instead of being able to access the page on /admin/users/list i only access it on /list.
Here is the controller :
<?php
namespace LanPartyOrg\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use JMS\SecurityExtraBundle\Annotation\PreAuthorize;
/*
* @Route("/admin")
*
*/
class AdminController extends Controller
{
/**
* @Route("/list", name="users_list")
* @Template("LanPartyOrgUserBundle:Admin:List.html.twig")
*/
public function listAction(){
$em = $this->getDoctrine()->getManager();
$users = $em->getRepository('LanPartyOrgUserBundle:User')->findAll();
return array('users'=>$users);
}
}
And here is my routing.yml :
lan_party_org_user:
resource: "@LanPartyOrgUserBundle/Controller/"
type: annotation
prefix: /
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
Thanks for any help