Answer the question
In order to leave comments, you need to log in
Why don't default parameters work in symfony2 routing?
The manuals describe that if, after inclusion in the defaults array after the specified action, set the default value of its parameter as here, then the parameter will correspond to the value specified by default, I give my example, which is identical in mana
manager_cpanel:
pattern: /manager/cpanel/{p}
defaults: { _controller: NiceBundle:manager\Manager:cpanel, p: "start" }
/**
* @Route("/cpanel/{p}")
* @Template()
*/
public function cpanelAction($p=null, Request $r){
return array("p"=>$p);
}
Answer the question
In order to leave comments, you need to log in
/**
* @Route("/cpanel/{p}", defaults={"p" = "start"})
* @Template()
*/
public function cpanelAction($p=null, Request $r){
return array("p"=>$p);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question