nette 2.0 to 3.1 and link method
- alnux
- Member | 139
hi,
i have a question in the past nette 2.0 this was worked
class ........
function x (Nette\Application\Application $application) {
return $application->presenter->link('this', array($this->presenterLanguageParam => $switchLang));
}
}
could you help me with this on nette 3.1 becouse link() method not works on
thanks
- mystik
- Member | 311
Above method should still work I think. Maybe just replace magic property access with direct getPresenter().
Thats way I asked how exactly it fails.
But accessing presenter from global state of Application is not very clean and might fail if used before current presenter id determined in reguest dispatching flow.
Where is this method located? Why cannot you pass presenter from caller instead of Application? I would need a bit more context for better advice.
Unless you need to access currently dispatched presenter (to be able to use this) recommended way would be to use LinkGenerator service and pass exact presenter.