Bladeren bron

Création d'une command pour supprimer visitor #488

develop
Fabien Normand 2 jaren geleden
bovenliggende
commit
ce99cdb8ff
6 gewijzigde bestanden met toevoegingen van 46 en 0 verwijderingen
  1. +1
    -0
      Builder/Order/OrderShopBuilder.php
  2. +1
    -0
      Builder/User/VisitorBuilder.php
  3. +11
    -0
      Repository/Order/OrderShopRepositoryQuery.php
  4. +11
    -0
      Repository/Order/OrderShopStore.php
  5. +14
    -0
      Repository/User/VisitorRepositoryQuery.php
  6. +8
    -0
      Repository/User/VisitorStore.php

+ 1
- 0
Builder/Order/OrderShopBuilder.php Bestand weergeven

@@ -171,6 +171,7 @@ class OrderShopBuilder
}

if (!$cart) {
dump('niche');
$cart = $this->create($section, $user, $visitor);
}


+ 1
- 0
Builder/User/VisitorBuilder.php Bestand weergeven

@@ -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'),

+ 11
- 0
Repository/Order/OrderShopRepositoryQuery.php Bestand weergeven

@@ -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

+ 11
- 0
Repository/Order/OrderShopStore.php Bestand weergeven

@@ -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();
}
}

+ 14
- 0
Repository/User/VisitorRepositoryQuery.php Bestand weergeven

@@ -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);
}
}

+ 8
- 0
Repository/User/VisitorStore.php Bestand weergeven

@@ -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();
}
}

Laden…
Annuleren
Opslaan