Bläddra i källkod

Page repo

packProduct
Charly 3 år sedan
förälder
incheckning
c9ee68d5be
2 ändrade filer med 68 tillägg och 0 borttagningar
  1. +9
    -0
      Repository/Site/PageRepositoryQuery.php
  2. +59
    -0
      Repository/Site/PageStore.php

+ 9
- 0
Repository/Site/PageRepositoryQuery.php Visa fil

@@ -4,10 +4,19 @@ namespace Lc\CaracoleBundle\Repository\Site;

use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\StatusRepositoryQueryTrait;
use Lc\SovBundle\Repository\Site\PageRepositoryQuery as SovPageRepositoryQuery;

class PageRepositoryQuery extends SovPageRepositoryQuery
{
use SectionRepositoryQueryTrait;
use StatusRepositoryQueryTrait;

public function filterByDevAlias(string $devAlias): self
{
return $this
->andWhere('.devAlias = :devAlias')
->setParameter('devAlias', $devAlias);
}

}

+ 59
- 0
Repository/Site/PageStore.php Visa fil

@@ -0,0 +1,59 @@
<?php

namespace Lc\CaracoleBundle\Repository\Site;

use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\Site\PageInterface;
use Lc\SovBundle\Repository\Site\PageStore as SovPageStore;

class PageStore extends SovPageStore
{
use SectionStoreTrait;

public function __construct(PageRepositoryQuery $query)
{
parent::__construct($query);
}

// TODO Vérifier si c'est good avec la section
// findPage
public function getOnePage(string $devAlias, SectionInterface $section = null): ?PageInterface
{
$query = $this->query->create();

if ($section == null) {
$section = $this->section;
}
$query
->filterIsOnline()
->filterByDevAlias($devAlias)
->filterBySection($section);

return $query->findOne();
}

// public function findPage($devAlias, $devAliasMerchant = false)
// {
// $merchant = false;
//
// if ($devAliasMerchant) {
// $merchant = $this->merchantUtils->getMerchantByDevAlias($devAliasMerchant);
// }
//
// if ($devAliasMerchant && $merchant) {
// $query = $this->createQueryBuilder('e')
// ->where('e.merchant = :merchant')
// ->setParameter('merchant', $merchant->getId());
// } else {
// $query = $this->findByMerchantQuery();
// }
//
// return $query->andWhere('e.status = 1')
// ->andWhere('e.devAlias = :devAlias')
// ->setParameter('devAlias', $devAlias)
// ->getQuery()
// ->getOneOrNullResult();
// }

}

Laddar…
Avbryt
Spara