Bladeren bron

Merge branch 'develop'

master
Guillaume Bourgeois 2 jaren geleden
bovenliggende
commit
e1a5230a6a
4 gewijzigde bestanden met toevoegingen van 31 en 28 verwijderingen
  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 Bestand weergeven

@@ -16,20 +16,21 @@ class VisitorBuilder
protected EntityManagerInterface $entityManager;

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

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

$this->entityManager->create($visitor);
$this->entityManager->flush();
@@ -37,9 +38,11 @@ class VisitorBuilder

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

$this->entityManager->update($visitor);
@@ -47,30 +50,32 @@ class VisitorBuilder
}

// 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
public function updateCookie($response): void
{
$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 Bestand weergeven

@@ -16,7 +16,6 @@ abstract class TicketAdminController extends SovTicketAdminController
{
return $this->getTicketContainer()
->getFactory()
->setSection($this->getSectionCurrent())
->setMerchant($this->getMerchantCurrent())
->create();
}
@@ -25,7 +24,6 @@ abstract class TicketAdminController extends SovTicketAdminController
{
return $this->getTicketContainer()->getFieldDefinition()
->setMerchant($this->getMerchantCurrent())
->setSection($this->getSectionCurrent())
->getFields($pageName);
}


+ 1
- 1
Model/Ticket/TicketModel.php Bestand weergeven

@@ -13,7 +13,7 @@ use Lc\SovBundle\Model\Ticket\TicketModel as SovTicketModel;
/**
* @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_ERROR = 'product-error';

+ 1
- 1
Repository/Product/ProductFamilyRepositoryQuery.php Bestand weergeven

@@ -55,7 +55,7 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery

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

Laden…
Annuleren
Opslaan