Newscoop\Entity\Repository\CommentRepository::getBatch PHP Method

getBatch() public method

Find comments for indexing
public getBatch ( mixed $count = self::BATCH_COUNT, array $filter = null ) : array
$count mixed Number of comments to index. When null default will be used
$filter array
return array
    public function getBatch($count = self::BATCH_COUNT, array $filter = null)
    {
        $qb = $this->createQueryBuilder('c');
        if (is_null($filter)) {
            $qb->where('c.indexed IS NULL')->orWhere('c.indexed < c.time_updated')->orderBy('c.time_updated', 'DESC');
        } else {
            throw new IndexException("Filter is not implemented yet.");
        }
        if (is_numeric($count)) {
            $qb->setMaxResults($count);
        }
        $batch = $qb->getQuery()->getResult();
        return $batch;
    }