Inject niekedy hodi null vynimku

MKI-Miro
Člen | 278
+
0
-

Ahojte

Mám takýto kus kódu

/** @var \App\Model\shippingRepository @inject */
    public $shippingRepository;

    public function renderDefault(): void
    {
        if ($this->countryId != 0)
        {
            $countryShippings = $this->shippingRepository->findAll()->....

Keď prídem na danú stránku všetko sa mi zobrazí vporiadku. Z času na čas ale nájdem exception v error logu

Error: Call to a member function findAll() on null
[2019-08-18 15-43-10] ----------------------------  @  https://www.puzzlemania.sk/doprava
[2019-08-18 15-48-03] Error: Call to a member function findAll() on null in /nfsmnt/hosting2_2/e/9/e92e7430-7908-48c7-83ea-4f117a5ce58b/puzzlemania.sk/web/app/presenters/DopravaPresenter.php:16 Stack trace: #0 [internal function]: App\Presenters\DopravaPresenter->renderDefault() #1 /nfsmnt/hosting2_2/e/9/e92e7430-7908-48c7-83ea-4f117a5ce58b/puzzlemania.sk/web/vendor/nette/application/src/Application/UI/Component.php(94): ReflectionMethod->invokeArgs(Object(App\Presenters\DopravaPresenter), Array) #2 /nfsmnt/hosting2_2/e/9/e92e7430-7908-48c7-83ea-4f117a5ce58b/puzzlemania.sk/web/vendor/nette/application/src/Application/UI/Presenter.php(217): Nette\Application\UI\Component->tryCall('renderdefault', Array) #3 /nfsmnt/hosting2_2/e/9/e92e7430-7908-48c7-83ea-4f117a5ce58b/puzzlemania.sk/web/vendor/nette/application/src/Application/Application.php(149): Nette\Application\UI\Presenter->run(Object(Nette\Application\Request)) #4 /nfsmnt/hosting2_2/e/9/e92e7430-7908-48c7-83ea-4f117a5ce58b/puzzlemania.sk/web/vendor/nette/application/src/Application/Application.php(85): Nette\Application\Application->processRequest(Object(Nette\Application\Request)) #5 /nfsmnt/hosting2_2/e/9/e92e7430-7908-48c7-83ea-4f117a5ce58b/puzzlemania.sk/web/www/index.php(10): Nette\Application\Application->run() #6 {main}  @  https://www.puzzlemania.sk/doprava
[2019-08-18 15-48-03] https://www.puzzlemania.sk/doprava  @  https://www.puzzlemania.sk/doprava
[2019-08-18 15-48-03] Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36  @  https://www.puzzlemania.sk/doprava
[2019-08-18 15-48-03] ----------------------------  @  https://www.puzzlemania.sk/doprava

Neviete v čom môže byť chyba?

Ďakujem

Kamil Valenta
Člen | 820
+
0
-

$shippingRepository je public, nesaháš na ni někde? Není možné, že ji někde jiný kus kódu setne na null?

MKI-Miro
Člen | 278
+
0
-

to urcite nie, skor to vyzera tak ze je potrebne vymazat cache