<?php

namespace App\Repository;

use App\Core\Repository\RepositoryQuery;
use Knp\Component\Pager\PaginatorInterface;
use App\Repository\ProjectRepository as Repository;
use App\Entity\Project;

class ProjectRepositoryQuery extends RepositoryQuery
{
    public function __construct(Repository $repository, PaginatorInterface $paginator)
    {
        parent::__construct($repository, 'p', $paginator);
    }

    public function published()
    {
        return $this
            ->andWhere('.status = :published')
            ->setParameter(':published', Project::PUBLISHED)
        ;
    }

    public function ordered()
    {
        return $this->orderBy('.sortOrder');
    }
}
