Kaynağa Gözat

Merge branch 'ideas' into develop

packProduct
Guillaume 3 yıl önce
ebeveyn
işleme
9b6220ec79
7 değiştirilmiş dosya ile 111 ekleme ve 21 silme
  1. +20
    -0
      Container/MyContainer.php
  2. +24
    -0
      Repository/AbstractRepositoryQuery.php
  3. +0
    -18
      Repository/Reminder/ReminderRepository.php
  4. +16
    -0
      Repository/Reminder/ReminderRepositoryQuery.php
  5. +32
    -0
      Repository/Reminder/ReminderStore.php
  6. +15
    -0
      Repository/RepositoryMerchantTrait.php
  7. +4
    -3
      Resolver/MerchantResolver.php

+ 20
- 0
Container/MyContainer.php Dosyayı Görüntüle

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

namespace Lc\CaracoleBundle\Container;

use Lc\CaracoleBundle\Resolver\MerchantResolver;

/**
* class MyContainer.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class MyContainer
{
public MerchantResolver $merchantResolver;

public function __construct(MerchantResolver $merchantResolver)
{
$this->merchantResolver = $merchantResolver;
}
}

+ 24
- 0
Repository/AbstractRepositoryQuery.php Dosyayı Görüntüle

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

namespace Lc\CaracoleBundle\Repository;

use Lc\SovBundle\Repository\AbstractRepositoryQuery as BaseAbstractRepositoryQuery;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\QueryBuilder;
use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Container\MyContainer;

abstract class AbstractRepositoryQuery extends BaseAbstractRepositoryQuery
{
public function __construct(
MyContainer $container,
ServiceEntityRepository $repository,
string $id,
PaginatorInterface $paginator = null
)
{
$this->container = $container;

parent::__construct($repository, $id, $paginator);
}
}

+ 0
- 18
Repository/Reminder/ReminderRepository.php Dosyayı Görüntüle

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

namespace Lc\CaracoleBundle\Repository\Reminder;

use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Model\Reminder\ReminderInterface;
use Lc\SovBundle\Repository\Reminder\ReminderRepository as SovReminderRepository;

/**
* @method ReminderInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ReminderInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ReminderInterface[] findAll()
* @method ReminderInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ReminderRepository extends SovReminderRepository
{
use RepositoryTrait;
}

+ 16
- 0
Repository/Reminder/ReminderRepositoryQuery.php Dosyayı Görüntüle

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

namespace Lc\CaracoleBundle\Repository\Reminder;

use Lc\CaracoleBundle\Repository\RepositoryMerchantTrait;
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryQuery as SovReminderRepositoryQuery;

/**
* class ReminderRepositoryQuery.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class ReminderRepositoryQuery extends SovReminderRepositoryQuery
{
use RepositoryMerchantTrait;
}

+ 32
- 0
Repository/Reminder/ReminderStore.php Dosyayı Görüntüle

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

namespace Lc\CaracoleBundle\Repository\Reminder;

use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;

/**
* class ReminderStore.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class ReminderStore extends SovReminderStore
{
protected MerchantInterface $merchant;

public function setMerchant(MerchantInterface $merchant)
{
$this->merchant = $merchant;
}

public function getFoo($query = null)
{
$query = $this->query->create();

if ($this->merchant) {
$query->filterByMerchant($this->merchant);
}

return parent::getFoo($query);
}
}

+ 15
- 0
Repository/RepositoryMerchantTrait.php Dosyayı Görüntüle

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

namespace Lc\CaracoleBundle\Repository;

use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;

trait RepositoryMerchantTrait
{
public function filterByMerchant(MerchantInterface $merchant)
{
return $this
->andWhere('.merchant = :merchant')
->setParameter(':merchant', $merchant);
}
}

+ 4
- 3
Resolver/MerchantResolver.php Dosyayı Görüntüle

@@ -46,9 +46,10 @@ class MerchantResolver
$request = $this->requestStack->getCurrentRequest();
$merchantRepository = $this->em->getRepository(MerchantInterface::class);
$merchants = $merchantRepository->findAll();
$isCli = php_sapi_name() === 'cli';

if ($request) {
if ($this->urlResolver->isServerLocalhost()) {
if ($request || $isCli) {
if ($isCli || $this->urlResolver->isServerLocalhost()) {
foreach ($merchants as $merchant) {
if ($merchant->getId() == $_ENV['CURRENT_MERCHANT_LOCAL']) {
$this->currentMerchant = $merchant;
@@ -102,4 +103,4 @@ class MerchantResolver
);
}

}
}

Yükleniyor…
İptal
Kaydet