for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Albert221\Blog\Repository\Database;
use Albert221\Blog\Repository\CategoryRepositoryInterface;
use Doctrine\ORM\EntityRepository;
class CategoryRepository extends EntityRepository implements CategoryRepositoryInterface
{
public function count()
$query = $this->createQueryBuilder('c')
->select('count(c.id)')
->getQuery();
return $query->getSingleScalarResult();
}
public function paginated($page, $perPage)
$first = ($page - 1) * $perPage;
->setFirstResult($first)
->setMaxResults($perPage)
return $query->getResult();
public function last($count)
->join('c.posts', 'p')
->orderBy('p.published_at', 'DESC')
->setMaxResults($count)