Is it possible to define multiple routes of same controller in a single definition?
For Example:
I want to have a single definition for
/, /about, /privacy-policy
using something like
_home:
pattern: {/ , /about, /privacy-policy}
defaults: { _controller: AcmeDemoBundle:Home:index, about, privacy_policy }
I don't want to define multiple routes in separate definition as suggested here.
EDIT: This is my source code:
<?php
namespace Acme\DemoBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class HomeController extends Controller
{
/**
* @Route("/")
*/
public function indexAction()
{
/*
* The action's view can be rendered using render() method
* or @Template annotation as demonstrated in DemoController.
*
*/
return $this->render('AcmeDemoBundle:Home:home.html.tpl');
}
/**
* @Route("/about")
*/
public function aboutAction()
{
return $this->render('AcmeDemoBundle:Home:about.html.tpl');
}
}
This is the source code of routing.yml
_home:
pattern: /
defaults: { _controller: AcmeDemoBundle:Home:index }
_welcome:
pattern: /
defaults: { _controller: AcmeDemoBundle:Welcome:index }
_demo_secured:
resource: "@AcmeDemoBundle/Controller/SecuredController.php"
type: annotation
_demo:
resource: "@AcmeDemoBundle/Controller/DemoController.php"
type: annotation
prefix: /demo