Symfony: trying to retrieve a variable saved using sfContext::getInstance()

Posted by user248959 on Stack Overflow See other posts from Stack Overflow or by user248959
Published on 2010-05-24T10:37:45Z Indexed on 2010/05/24 10:41 UTC
Read the original article Hit count: 122

Filed under:

Hi,

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

© Stack Overflow or respective owner

Related posts about symfony