2016-02-29 39 views
1

我是symfony的新手。從symfony中不工作的包導入的路由

所以我創建了一個包用的忍者/ UserBundle

命名空間在這個包我有一個路由配置,如下所示:

shinobi_user: 
    resource: "@ShinobiUserBundle/Controller" 
    type:  annotation 

和應用程序/配置/ routing.yml文件裏面我寫了下面像這樣:

shinobi_user: 
    resource: "@ShinobiUserBundle/Resources/config/routing.yml" 
    prefix: /

app: 
    resource: "@AppBundle/Controller/" 
    type:  annotation 

當我試圖去這個網址

http://www.pilipinas.local/app_dev.php/default/

它說/發現「GET /默認

沒有路由

這是我裏面ShinobiUserBundle控制器:

/** 
* @Route("/default") 
*/ 
class DefaultController extends Controller 
{ 
    /** 
    * @Route("/", name="user") 
    */ 
    public function indexAction() 
    { 
     return $this->render('ShinobiUIBundle:Default:index.html.twig'); 
    } 
} 

我是什麼做錯了?

謝謝!

回答

1

你不能像這樣給你的整個控制器路由。那是錯的。

刪除

/** * @Route("/default") */

這部分由控制器和刪除

shinobi_user: 
resource: "@ShinobiUserBundle/Resources/config/routing.yml" 
prefix: /

這部分從routing.yml中,然後調用

http://www.pilipinas.local/app_dev.php/

你會看到你的user命名的網址我的意思是這部分;

/** 
* @Route("/", name="user") 
*/ 
public function indexAction() 
{ 
    return $this->render('ShinobiUIBundle:Default:index.html.twig'); 
}