In my project I use the framework as Symfony2. I wanted to write a php function that redirect to a default page if a condition fails. so my function was like this.
public function validate($value){
if($value==null){
return $this->redirect(
$this->generateUrl('home_page', array("message"=>""))
);
}
}
and I call the function like this.
$this->validate($value);
problem is redirect does not happens.
please guys, help me. I don't know why it is not redirecting.
Thanks