@@ -171,6 +171,7 @@ class OrderShopBuilder | |||
} | |||
if (!$cart) { | |||
dump('niche'); | |||
$cart = $this->create($section, $user, $visitor); | |||
} | |||
@@ -49,6 +49,7 @@ class VisitorBuilder | |||
// setCookieVisitor | |||
public function setCookie($response, $cookie): void | |||
{ | |||
dump('NICICIIC'); | |||
$response->headers->setCookie( | |||
Cookie::create( | |||
$this->parameterBag->get('app.cookie_name_visitor'), |
@@ -107,6 +107,12 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery | |||
->setParameter('user', $user); | |||
} | |||
public function filterByUserIsNull(): self | |||
{ | |||
return $this | |||
->andWhere('.user IS NULL'); | |||
} | |||
public function filterByUserEmail(string $email): self | |||
{ | |||
$this->joinUser(); | |||
@@ -205,6 +211,11 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery | |||
return $this->andWhereEqual('visitor', $visitor); | |||
} | |||
public function filterByVisitorIsNull(): self | |||
{ | |||
return $this->andWhere('.visitor IS NULL'); | |||
} | |||
public function filterByAddress(AddressInterface $address): self | |||
{ | |||
return $this |
@@ -662,4 +662,15 @@ class OrderShopStore extends AbstractStore | |||
return true; | |||
} | |||
public function getCartAlone($query = null){ | |||
$query = $this->createQuery($query); | |||
$query->filterByAlias(OrderStatusModel::$statusAliasAsCart); | |||
$query->filterByUserIsNull(); | |||
$query->filterByVisitorIsNull(); | |||
dump($query->getQueryBuilder()->getDQL()); | |||
return $query->limit(100000)->find(); | |||
} | |||
} |
@@ -18,4 +18,18 @@ class VisitorRepositoryQuery extends AbstractRepositoryQuery | |||
->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); | |||
} | |||
} |
@@ -36,4 +36,12 @@ class VisitorStore extends AbstractStore | |||
$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->find(); | |||
} | |||
} |