*/ class TaskSchemaRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, TaskSchema::class); } public function allSchemas(): TaskSchemaCollection { return new TaskSchemaCollection(parent::findAll()); } /** @return list */ public function findActive(): array { return $this->createQueryBuilder('s') ->andWhere('s.status = :status') ->setParameter('status', TaskSchemaStatus::Active) ->getQuery() ->getResult(); } /** @return list */ public function findExpired(): array { return $this->createQueryBuilder('s') ->andWhere('s.end IS NOT NULL') ->andWhere('s.end < :today') ->setParameter('today', new \DateTimeImmutable('today')) ->getQuery() ->getResult(); } }