[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 :
namespace App\Repository; use App\Entity\Type; use App\Entity\User; use App\Entity\Meet; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Psr\Log\LoggerInterface; /** * @method Type|null find($id, $lockMode = null, $lockVersion = null) * @method Type|null findOneBy(array $criteria, array $orderBy = null) * @method Type[] findAll() * @method Type[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class TypeRepository extends ServiceEntityRepository { private $loggger; public function __construct(ManagerRegistry $registry, LoggerInterface $logger) { parent::__construct($registry, Type::class); $this->loggger = $logger; } .... public function getNoTypedUsersList($matchday) { // Pobranie listy telefonów użytkowników, którzy jeszcze nie podali typów $sql = 'SELECT u.phone, u.id ' . 'FROM type t ' . 'INNER JOIN user u ON t.user_id = u.id ' . 'INNER JOIN meet m ON t.meet_id = m.id ' . 'INNER JOIN matchday md ON m.matchday_id = md.id ' . 'WHERE md.id = :matchday ' . 'AND u.status = 1 ' . 'GROUP BY u.id ' . 'HAVING COUNT(t.user_id) > 0 '; $userTypes = $this->getEntityManager()->getConnection()->executeQuery($sql, $params)->fetchAll(); // Pobieram wszystkich aktywnych użytkowników $userRepo = $this->getEntityManager()->getRepository(User::class); $users = $userRepo->findByStatus(1); $this->logger->info('DC $users: ' . $users);
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 ?