<?php

namespace Market\ZodacoBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * NotificationsRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class NotificationsRepository extends EntityRepository
{

    public function getTop($page = 1, $limit = 100) {
        $q = 'SELECT c FROM MarketZodacoBundle:Notifications c ';
        $q .= ' ORDER BY c.id ASC';
        return $this->getEntityManager()
                        ->createQuery($q)
                        ->setMaxResults($limit)
                        ->setFirstResult(($page - 1) * $limit)
                        ->getResult();
    }
}
