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