I have two controllers. I find problem in passing posted values from one controller to another. Here is a quick view,
This is the function 1
public function setRole(request $request){
this->forward(Path,array(role=>$role));
this->redirect(path of second controller);
}
This is the function 2.
public function getRole(request $request){
$role = $request->get('role');//when printing this $role, I am able to get the value of $role.
$sql = "select * from table where id=$role"; // I cannot get the value in this qry ,also, i cannot pass the value to a twig file
return render...(filename,array('roleid'=>$role));
}
Problem is I could'n access the variable "roleid" in my twig file of second controller. Always it goes empty.
Is there anything i have missed here?