Browse Source

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

develop
Fabien Normand 2 years ago
parent
commit
ce99cdb8ff
6 changed files with 46 additions and 0 deletions
  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 View File

} }


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



+ 1
- 0
Builder/User/VisitorBuilder.php View File

// setCookieVisitor // setCookieVisitor
public function setCookie($response, $cookie): void public function setCookie($response, $cookie): void
{ {
dump('NICICIIC');
$response->headers->setCookie( $response->headers->setCookie(
Cookie::create( Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'), $this->parameterBag->get('app.cookie_name_visitor'),

+ 11
- 0
Repository/Order/OrderShopRepositoryQuery.php View File

->setParameter('user', $user); ->setParameter('user', $user);
} }


public function filterByUserIsNull(): self
{
return $this
->andWhere('.user IS NULL');
}

public function filterByUserEmail(string $email): self public function filterByUserEmail(string $email): self
{ {
$this->joinUser(); $this->joinUser();
return $this->andWhereEqual('visitor', $visitor); return $this->andWhereEqual('visitor', $visitor);
} }


public function filterByVisitorIsNull(): self
{
return $this->andWhere('.visitor IS NULL');
}

public function filterByAddress(AddressInterface $address): self public function filterByAddress(AddressInterface $address): self
{ {
return $this return $this

+ 11
- 0
Repository/Order/OrderShopStore.php View File



return true; 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 View File

->andWhere('.cookie LIKE :cookie') ->andWhere('.cookie LIKE :cookie')
->setParameter('cookie', $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 View File

$query->filterByCookie($cookie); $query->filterByCookie($cookie);
return $query->findOne(); return $query->findOne();
} }

public function getOldVisitors(\DateTime $lastAccess, $query = null){

$query = $this->createDefaultQuery($query);
$query->filterByLastAccess($lastAccess);
// $query->filterByTotalVisit(1);
return $query->find();
}
} }

Loading…
Cancel
Save