I have this generate url link in symfony 2 :
$route = $this->generateUrl('mail', array('from' => $oSender->getSettingValue(), 'adres' => (empty($aInfo['executorEmail']) ? '[email protected]' : $aInfo['executorEmail']), 'subject' => 'Werkbonnen project ' . $aInfo['projectName'] . ' week ' . $aInfo['workOrderWeeknumber'], 'name' => $aInfo['executorName'], 'filename' => $filename, 'filename2' => '', 'workOrderId' => $id)); route annotation:
/** * @Route("/workorder/mail/{from}/{adres}/{subject}/{name}/{filename}/{filename2}/{workOrderId}", name="mail") * @Template() */ And this function where the generate route is going:
public function mailAction(Request $request, $from = '', $adres = '', $subject = '', $name = '', $filename = '', $filename2 = '', $workOrderId) { // some code here not important } It keeps saying this :
Parameter "filename2" for route "mail" must match "[^/]++" ("" given) to generate a corresponding URL. How can i give a empty value with the generateUrl function in symfony. variable filename2 is optional.
Thanks!