2012-11-23 58 views

回答

0

我按照這裏本教程,這似乎爲我工作:

http://forum.symfony-project.org/viewtopic.php?t=38793&p=127825

引述:

裝載機:

namespace MyName\MyBundle; 

use Symfony\Component\Config\Loader\Loader; 
use Symfony\Component\Routing\RouteCollection; 
use Symfony\Component\Routing\Route; 

class MyRouteLoader extends Loader 
{ 
    public function supports($resource, $type=null) 
    { 
     return 'my_new_resource_type' === $type; 
    } 

    public function load($resource, $type=null) 
    { 
     $collection = new RouteCollection(); 
     $collection->addRoute(new Route(...)); 
     return $collection; 
    } 
} 

服務:

services: 
    my_route_loader: 
     class: MyName\MyBundle\MyRouteLoader 
     tags: 
      - {name: routing.loader}