2015-04-08 145 views
0

我已經定義了一個控制器註解Symfony2的路由默認

@Route("/add,{elId},{elType},{parentId}",name="MeaTask_Add", defaults={"elId"=null,"elType"=null, "parentId"=null}) 
public function addAction($elId=null, $elType=null, $parentId=null, Request $request){ 

我嘗試使用它喜歡這裏

$this->generateUrl('MeaTask_Add',array(
        'parentId'=>$parentId   
       )) 

,並得到

An exception has been thrown during the rendering of a template ("Parameter "elType" for route "MeaTask_Add" must match "[^/,]++" ("" given) to generate a corresponding URL.") 

回答

0
@Route("/add/{elId}/{elType}/{parentId}",name="MeaTask_Add", defaults={"elId"=null,"elType"=null, "parentId"=null}) 

嘗試用斜槓我註釋路徑url不能處理c OMA。