*/ final class ObservationRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Observation::class); } /** * @return Observation[] */ public function findByMonth(DateTimeImmutable $from, DateTimeImmutable $to): array { return $this->createQueryBuilder('o') ->andWhere('o.month >= :from') ->andWhere('o.month <= :to') ->setParameter('from', $from) ->setParameter('to', $to) ->innerJoin('o.employee', 'e') ->addSelect('e') ->getQuery() ->getResult() ; } }