entityManager = self::getContainer()->get(EntityManagerInterface::class); $this->candidateRepository = self::getContainer()->get(CandidateRepository::class); $this->questionRepository = self::getContainer()->get(QuestionRepository::class); $this->quizCandidateRepository = self::getContainer()->get(QuizCandidateRepository::class); $this->quizRepository = self::getContainer()->get(QuizRepository::class); $this->seasonRepository = self::getContainer()->get(SeasonRepository::class); $this->userRepository = self::getContainer()->get(UserRepository::class); } protected function getUserByEmail(string $email): User { $user = $this->userRepository->findOneBy(['email' => $email]); $this->assertInstanceOf(User::class, $user); return $user; } protected function getSeasonByCode(string $code): Season { $season = $this->seasonRepository->findOneBySeasonCode($code); $this->assertInstanceOf(Season::class, $season); return $season; } protected function getCandidateBySeasonAndName(Season $season, string $name): Candidate { $candidate = $this->candidateRepository->findOneBy(['season' => $season, 'name' => $name]); $this->assertInstanceOf(Candidate::class, $candidate); return $candidate; } }