Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

48 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\User;
  3. use Lc\CaracoleBundle\Repository\AbstractStore;
  4. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  5. class VisitorStore extends AbstractStore
  6. {
  7. protected VisitorRepositoryQuery $query;
  8. public function __construct(VisitorRepositoryQuery $query)
  9. {
  10. $this->query = $query;
  11. }
  12. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  13. {
  14. $query->orderBy('id');
  15. return $query;
  16. }
  17. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  18. {
  19. return $query;
  20. }
  21. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  22. {
  23. return $query;
  24. }
  25. public function getOneByCookie(string $cookie = null, $query = null)
  26. {
  27. $query = $this->createDefaultQuery($query);
  28. $query->filterByCookie($cookie);
  29. return $query->findOne();
  30. }
  31. public function getOldVisitors(\DateTime $lastAccess, $query = null){
  32. $query = $this->createDefaultQuery($query);
  33. $query->filterByLastAccess($lastAccess);
  34. $query->filterByTotalVisit(1);
  35. return $query->limit(10000)->find();
  36. }
  37. }