<?php

namespace AutoAdmin\Bundle\Cache\Repository;

use AutoAdmin\Bundle\Content\Repository\AbstractContentRepository;
use DateTime;

class CacheLogRepository extends AbstractContentRepository
{
    public function findBefore(DateTime $before, int $limit = 100000)
    {
        $qb = $this->createQueryBuilder('cl');
        $qb->where('cl.createdAt < :before');
        $qb->setParameter('before', $before);
        $qb->setMaxResults($limit);

        return $qb->getQuery()->getResult();
    }
}
