Helpers splitName throwing exception

Nacioszeczek
Member | 3
+
0
-

Hey, I can't use

$this->redirect(...);

in any constructors or function that constructors use. Everytime I try to use it the following error (attached file) is thrown, however I can use redirect in actions/renders.
So far I tried updating files with composer.

Exception message:
Argument 1 passed to Nette\Application\Helpers::splitName() must be of the type string, null given, called in path\vendor\nette\application\src\Application\UI\Presenter.php on line 786

Tracy HTML exception file: https://jsfiddle.net/de6tp8wb/

Thanks in advance to anyone who is wishing to help!

Last edited by Nacioszeczek (2020-09-23 17:27)

David Matějka
Moderator | 6445
+
+2
-

Hi,
it is not possible to use this method (and many other) in a presenter constructor. Use startup or action* methods

dkorpar
Member | 135
+
+3
-

Having any logic in constructor is considered bad. Keep them clean and try just assigning your dependencies there, nothing else.

Nacioszeczek
Member | 3
+
0
-

Will do, thanks :P