Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony2 Multiple Routes for Single Controller
    primarykey
    data
    text
    <p>Is it possible to define multiple routes of same controller in a single definition?</p> <p>For Example:</p> <p>I want to have a single definition for</p> <pre><code>/, /about, /privacy-policy </code></pre> <p>using something like </p> <pre><code>_home: pattern: {/ , /about, /privacy-policy} defaults: { _controller: AcmeDemoBundle:Home:index, about, privacy_policy } </code></pre> <p>I don't want to define multiple routes in separate definition as suggested <a href="https://stackoverflow.com/questions/11363103/multiple-pattern-in-single-symfony-routing">here</a>.</p> <p><strong>EDIT</strong>: This is my source code:</p> <pre><code>&lt;?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-&gt;render('AcmeDemoBundle:Home:home.html.tpl'); } /** * @Route("/about") */ public function aboutAction() { return $this-&gt;render('AcmeDemoBundle:Home:about.html.tpl'); } } </code></pre> <p>This is the source code of routing.yml</p> <pre><code>_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 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload