Reputation: 9265
Let's assume in Symfony you have a BackendController
.
Then all backend controllers follow e.g. ProjectsController extends BackendController
.
Is there a way to set Symfony up so that all controllers that extend BackendController
route to somesite.com/auth
Such that
class ProjectsController extends BackendController
{
/**
* @Route("projects");
*/
public function index() {
route projects
resolves to auth/projects
without having to explicitly state it @Route("auth/projects");
?
Please be gentle; I'm extremely new to Symfony.
Upvotes: 1
Views: 996
Reputation: 2710
The class level route definitions are not inherited meaning that this isn't possible. The next best thing you can do is to define that base route separately on class level for all controllers inheriting the base class:
/**
* @Route("/auth")
*/
class ProjectsController extends BackendController
{
/**
* @Route("/projects");
*/
public function index() {
...
}
...
}
Upvotes: 4