i have these methods in module1/actions/actions.class.php:
public function executeMethod1(sfWebRequest $request){
$a = 10;
sfContext::getInstance()->set('a', $a);
return $this->redirect('module1/method2');
}
public function executeMethod2(sfWebRequest $request){
echo sfContext::getInstance()->get('a');
}
When i execute module1/method1 i get this error:
"The "a" object does not exist in the current context."
Any idea?
Javi
The redirect is telling the browser to load another page which terminates the current action and results in a new request that has a new context.
There are three options here:
module1/method2
to be executed as the result of the first request.$a
to the next request.$a
has to live beyond the next request.EDIT: You don't need the
return
statement before the redirect either.