Преглед на файлове

Merge branch 'develop'

master
Guillaume Bourgeois преди 2 години
родител
ревизия
e1a5230a6a
променени са 4 файла, в които са добавени 31 реда и са изтрити 28 реда
  1. +29
    -24
      Builder/User/VisitorBuilder.php
  2. +0
    -2
      Controller/Ticket/TicketAdminController.php
  3. +1
    -1
      Model/Ticket/TicketModel.php
  4. +1
    -1
      Repository/Product/ProductFamilyRepositoryQuery.php

+ 29
- 24
Builder/User/VisitorBuilder.php Целия файл

protected EntityManagerInterface $entityManager; protected EntityManagerInterface $entityManager;


public function __construct( public function __construct(
EntityManagerInterface $entityManager,
CookieComponent $cookieComponent,
ParameterBagInterface $parameterBag
) {
EntityManagerInterface $entityManager,
CookieComponent $cookieComponent,
ParameterBagInterface $parameterBag
)
{
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->cookieComponent = $cookieComponent; $this->cookieComponent = $cookieComponent;
$this->parameterBag = $parameterBag; $this->parameterBag = $parameterBag;
} }


// addVisitor // addVisitor
public function create(string $cookie, string $ip)
public function create(string $cookieValue, string $ip)
{ {
$visitorFactory = new VisitorFactory(); $visitorFactory = new VisitorFactory();
$visitor = $visitorFactory->create($cookie, $ip);
$visitor = $visitorFactory->create($cookieValue, $ip);


$this->entityManager->create($visitor); $this->entityManager->create($visitor);
$this->entityManager->flush(); $this->entityManager->flush();


public function update(VisitorInterface $visitor) public function update(VisitorInterface $visitor)
{ {
$totalVisit = $visitor->getTotalVisit() + 1;
if($visitor->getLastAccess() < new \DateTime('-1 hour')) {
$totalVisit = $visitor->getTotalVisit() + 1;
$visitor->setTotalVisit($totalVisit);
}


$visitor->setTotalVisit($totalVisit);
$visitor->setLastAccess(new \DateTime()); $visitor->setLastAccess(new \DateTime());


$this->entityManager->update($visitor); $this->entityManager->update($visitor);
} }


// setCookieVisitor // setCookieVisitor
public function setCookie($response, $cookie): void
public function setCookie($response, $cookieValue): Cookie
{ {
$response->headers->setCookie(
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($cookie),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
)
$cookie = Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($cookieValue),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
); );

$response->headers->setCookie($cookie);

return $cookie;
} }


// updateVisitorCookie // updateVisitorCookie
public function updateCookie($response): void public function updateCookie($response): void
{ {
$response->headers->setCookie( $response->headers->setCookie(
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($this->getVisitorCurrent()->getCookie()),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
)
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($this->getVisitorCurrent()->getCookie()),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
)
); );
} }



+ 0
- 2
Controller/Ticket/TicketAdminController.php Целия файл

{ {
return $this->getTicketContainer() return $this->getTicketContainer()
->getFactory() ->getFactory()
->setSection($this->getSectionCurrent())
->setMerchant($this->getMerchantCurrent()) ->setMerchant($this->getMerchantCurrent())
->create(); ->create();
} }
{ {
return $this->getTicketContainer()->getFieldDefinition() return $this->getTicketContainer()->getFieldDefinition()
->setMerchant($this->getMerchantCurrent()) ->setMerchant($this->getMerchantCurrent())
->setSection($this->getSectionCurrent())
->getFields($pageName); ->getFields($pageName);
} }



+ 1
- 1
Model/Ticket/TicketModel.php Целия файл

/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class TicketModel extends SovTicketModel implements FilterSectionInterface, FilterMerchantInterface
abstract class TicketModel extends SovTicketModel implements FilterMerchantInterface
{ {
const TYPE_PRODUCT_UNAVAILABLE = 'product-unavailable'; const TYPE_PRODUCT_UNAVAILABLE = 'product-unavailable';
const TYPE_PRODUCT_ERROR = 'product-error'; const TYPE_PRODUCT_ERROR = 'product-error';

+ 1
- 1
Repository/Product/ProductFamilyRepositoryQuery.php Целия файл



$this->leftJoin('.qualityLabels', 'qualityLabels'); $this->leftJoin('.qualityLabels', 'qualityLabels');
if ($addSelect) { if ($addSelect) {
$this->addSelect('qualityLabels');
//$this->addSelect('qualityLabels');
} }
} }
return $this; return $this;

Loading…
Отказ
Запис