title: Is there a way to "Inherit" a controller's prefix in Symfony 2?
body: <p>Is there any way to for one controller to inherit another controller's routing prefix in Symfony2?</p>
  
  <p>I'd like to create an "admin" route and controller that other controllers can inherit the base prefix from, e.g. The admin class would start something like this:</p>
  
  <pre><code>/**
   * @Route("/admin")
   */
  class AdminController {...}
  </code></pre>
  
  <p>And then another class could then "inherit" only the prefix and add to it with its own prefix, example:</p>
  
  <pre><code>/**
   * @Route("/news")
   * @InheritPrefix("AdminController") &lt;-- an imaginary annotation to show what I mean
   */
  class NewsController
  {
      /**
       * @Route("/", name="admin_news")
       */
      public function indexAction() {...}
  
      /**
       * @Route("/list-all", name="admin_news_list-all")
       */
      public function listAllAction() {...}
  }
  </code></pre>
  
  <p>The result would be that the URL /admin/news would be routed to the NewsController::indexAction() and /admin/news/list-all would redirect to NewsController::listAllAction()</p>
  
  <p>Then a second class could be created, e.g.</p>
  
  <pre><code>/**
   * @Route("/photos")
   * @InheritPrefix("AdminController") &lt;-- an imaginary annotation to show what I mean
   */
  class PhotoController
  {
      /**
       * @Route("/new", name="admin_photos_new")
       */
      public function newAction() {...}
  }
  </code></pre>
  
  <p>Then the url /admin/photos/new would redirect to PhotoController::newAction()</p>
  
  <p>I know about the SonataAdminBundle but wanted to know if there was a way to do this without that bundle.</p>