简体   繁体   中英

symfony2 routing defaults

I have defined a controller with annotation

@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){

I try to use it like here

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

and get

  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.") 
@Route("/add/{elId}/{elType}/{parentId}",name="MeaTask_Add", defaults={"elId"=null,"elType"=null, "parentId"=null})

尝试用斜杠,我不是注释路由URL可以处理昏迷。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM