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