|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository\User;
-
- use Lc\CaracoleBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class VisitorStore extends AbstractStore
- {
- protected VisitorRepositoryQuery $query;
-
- public function __construct(VisitorRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function getOneByCookie(string $cookie = null, $query = null)
- {
- $query = $this->createDefaultQuery($query);
- $query->filterByCookie($cookie);
- return $query->findOne();
- }
-
- public function getOldVisitors(\DateTime $lastAccess, $query = null){
-
- $query = $this->createDefaultQuery($query);
- $query->filterByLastAccess($lastAccess);
- $query->filterByTotalVisit(1);
- return $query->limit(10000)->find();
- }
- }
|