Browse Source

Refactoring frontend

develop
Guillaume 3 years ago
parent
commit
5b69add175
3 changed files with 12 additions and 46 deletions
  1. +7
    -43
      Controller/AbstractController.php
  2. +3
    -3
      Repository/AbstractRepositoryQuery.php
  3. +2
    -0
      Repository/AbstractStore.php

+ 7
- 43
Controller/AbstractController.php View File

@@ -2,51 +2,8 @@

namespace Lc\SovBundle\Controller;

use App\Container\Delivery\DeliveryAvailabilityPointSaleContainer;
use App\Container\Delivery\DeliveryAvailabilityZoneContainer;
use App\Container\Delivery\DeliveryPriceContainer;
use App\Container\Delivery\DeliverySlotContainer;
use App\Container\Delivery\DeliveryZoneContainer;
use App\Container\Notification\NotificationContainer;
use App\Container\Notification\NotificationLogContainer;
use App\Container\Notification\NotificationUserContainer;
use App\Container\Order\PurchaseOrderContainer;
use App\Container\Product\SupplierContainer;
use App\Container\Sponsor\SponsorContainer;
use App\Payment\SystemPay;
use App\Solver\Price\PriceSolver;
use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Container\Address\AddressContainer;
use Lc\CaracoleBundle\Container\Config\TaxRateContainer;
use Lc\CaracoleBundle\Container\Config\UnitContainer;
use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer;
use Lc\CaracoleBundle\Container\File\DocumentContainer;
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer;
use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer;
use Lc\CaracoleBundle\Container\Order\OrderProductContainer;
use Lc\CaracoleBundle\Container\Order\OrderProductReductionCatalogContainer;
use Lc\CaracoleBundle\Container\Order\OrderProductRefundContainer;
use Lc\CaracoleBundle\Container\Order\OrderReductionCartContainer;
use Lc\CaracoleBundle\Container\Order\OrderReductionCreditContainer;
use Lc\CaracoleBundle\Container\Order\OrderRefundContainer;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Container\Order\OrderStatusContainer;
use Lc\CaracoleBundle\Container\Order\OrderStatusHistoryContainer;
use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer;
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer;
use Lc\CaracoleBundle\Container\Product\ProductContainer;
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer;
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer;
use Lc\CaracoleBundle\Container\Reduction\ReductionCreditContainer;
use Lc\CaracoleBundle\Container\Section\OpeningContainer;
use Lc\CaracoleBundle\Container\Section\SectionContainer;
use Lc\CaracoleBundle\Container\Setting\MerchantSettingContainer;
use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer;
use Lc\CaracoleBundle\Container\User\UserMerchantContainer;
use Lc\CaracoleBundle\Container\User\UserPointSaleContainer;
use Lc\CaracoleBundle\Container\User\VisitorContainer;
use Lc\SovBundle\Container\ComponentContainer;
use Lc\SovBundle\Container\File\FileContainer;
use Lc\SovBundle\Container\Newsletter\NewsletterContainer;
@@ -69,6 +26,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment;

class AbstractController extends SfAbstractController
{
@@ -78,6 +36,7 @@ class AbstractController extends SfAbstractController
return array_merge(
parent::getSubscribedServices(),
[
Environment::class => Environment::class,
Security::class => Security::class,
EntityManagerInterface::class => EntityManagerInterface::class,
UrlGeneratorInterface::class => UrlGeneratorInterface::class,
@@ -109,6 +68,11 @@ class AbstractController extends SfAbstractController
return $request->headers->get('referer');
}

public function getTemplating(): Environment
{
return $this->get(Environment::class);
}

public function getEntityManager(): EntityManagerInterface
{
return $this->get(EntityManagerInterface::class);

+ 3
- 3
Repository/AbstractRepositoryQuery.php View File

@@ -163,15 +163,15 @@ abstract class AbstractRepositoryQuery implements RepositoryQueryInterface
*/
public function filterIsParent():self
{
return $this->andWhere('.parent is NULL');
return $this->andWhere('.parent IS NULL');
}

public function filterIsChildren():self
{
return $this->andWhere('.parent is NOT NULL');
return $this->andWhere('.parent IS NOT NULL');
}

public function filterByParent(EntityInterface $parent):self
public function filterByParent(EntityInterface $parent = null):self
{
return $this->andWhere('.parent = :parent')->setParameter('parent', $parent);
}

+ 2
- 0
Repository/AbstractStore.php View File

@@ -110,9 +110,11 @@ abstract class AbstractStore implements StoreInterface
public function getParent(bool $isOnline = true, $query = null)
{
$query = $this->createDefaultQuery($query);

if ($isOnline) {
$query->filterIsOnline();
}

$query->filterIsParent();

return $query->find();

Loading…
Cancel
Save