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