Persistent parameter of component is not carried over on presenter redirect
Notice: This thread is very old.
- josef.sabl
- Member | 153
I have component named MyComp that has persistent parameter $foo and it lives in my HomepagePresenter, particularly it is used in Default action. I also have another action called RedirectFoo($foo) that is supposed to set the $foo parameter of MyComp to specific value. It however doesn't seem to work and the persistent parameter not carried over on redirect.
I have it like this:
class MyComp extends \Nette\Application\UI\Control
{
/** @persistent */
public $foo;
}
class HomepagePresenter extends BasePresenter
{
public function actionRedirectFoo($foo)
{
$this['myComp']->foo = $foo;
$this->redirect('default');
}
public function createComponentMyComp()
{
return new MyComp;
}
}
- David Matějka
- Moderator | 6445
you can mark a component as a persistent, iirc it should look like this:
/**
* @persistent(myComp)
*/
class HomepagePresenter
- josef.sabl
- Member | 153
Didn't know about this feature, it works, thank you!
David Matějka wrote:
you can mark a component as a persistent, iirc it should look like this:
/** * @persistent(myComp) */ class HomepagePresenter