[SF][Symfony2][SF2] LoggerInterface problem, Logger w klasie Repository |
[SF][Symfony2][SF2] LoggerInterface problem, Logger w klasie Repository |
13.07.2022, 22:13:48
Post
#1
|
|
Grupa: Zarejestrowani Postów: 496 Pomógł: 2 Dołączył: 15.07.2011 Skąd: Katowice Ostrzeżenie: (0%) |
Próbowałem wylogować sobie coś w klasie Repozytorium i mam taki błąd:
[2022-07-11 23:52:02] console.ERROR: Error thrown while running command "app:przypominajka". Message: "Call to a member function info() on null" {"exception":"[object] (Error(code: 0): Call to a member function info() on null at /home/dcpl/domains/test.o10.pl/src/Repository/TypeRepository.php:267)","command":"app:przypominajka","message":"Call to a member function info() on null"} [] Klasa TypeRepository :
Wskazana w logu z błędem linia 267 to : $this->logger->info('DC $users: ' . $users); w powyższej metodzie getNoTypedUsersList nie wiem czy źle wstrzyknąłem LoggerInterface ? |
|
|
14.07.2022, 05:34:17
Post
#2
|
|
Grupa: Zarejestrowani Postów: 6 373 Pomógł: 1116 Dołączył: 30.08.2006 Ostrzeżenie: (0%) |
$this->loggger 3 g potem się odwołujesz do logger
-------------------- |
|
|
14.07.2022, 09:23:10
Post
#3
|
|
Grupa: Zarejestrowani Postów: 377 Pomógł: 70 Dołączył: 15.07.2014 Ostrzeżenie: (0%) |
Logger jest nullerm z jakiegoś powodu.
"Powiedziałeś" Symfony, że to Service? W 2 z tego co pamiętam, nie ma autowire'ingu, więc musisz jawnie przekazać klasę do swojego Repository. |
|
|
14.07.2022, 15:24:58
Post
#4
|
|
Grupa: Zarejestrowani Postów: 496 Pomógł: 2 Dołączył: 15.07.2011 Skąd: Katowice Ostrzeżenie: (0%) |
Viking miał rację ... miałem literówkę : loggger zamiast logger.
Dzięki. |
|
|
14.07.2022, 19:03:04
Post
#5
|
|
Grupa: Zarejestrowani Postów: 377 Pomógł: 70 Dołączył: 15.07.2014 Ostrzeżenie: (0%) |
Czego używasz do kodowania, że IDE / Edytor tego nie wyłapał?
|
|
|
Wersja Lo-Fi | Aktualny czas: 27.09.2024 - 05:24 |