|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\User;
-
- use Knp\Component\Pager\PaginatorInterface;
- use Lc\SovBundle\Repository\AbstractRepositoryQuery;
-
- class VisitorRepositoryQuery extends AbstractRepositoryQuery
- {
- public function __construct(VisitorRepository $repository, PaginatorInterface $paginator)
- {
- parent::__construct($repository, 'visitor', $paginator);
- }
-
- public function filterByCookie(string $cookie = null)
- {
- if(is_null($cookie)) {
- return $this->andWhere('.cookie IS NULL');
- }
- else {
- return $this
- ->andWhere('.cookie LIKE :cookie')
- ->setParameter('cookie', $cookie);
- }
- }
-
- public function filterByLastAccess(\DateTime $lastAccess)
- {
- return $this
- ->andWhere('.lastAccess < :lastAccess')
- ->setParameter('lastAccess', $lastAccess);
- }
-
- public function filterByTotalVisit(int $totalVisit)
- {
- return $this
- ->andWhere('.totalVisit = :totalVisit')
- ->setParameter('totalVisit', $totalVisit);
- }
- }
|