Browse Source

Refactoring repositoryQuery id d'entité

packProduct
Fabien Normand 2 years ago
parent
commit
a3c464d030
35 changed files with 125 additions and 126 deletions
  1. +1
    -1
      Repository/Address/AddressRepositoryQuery.php
  2. +1
    -1
      Repository/Config/TaxRateRepositoryQuery.php
  3. +1
    -1
      Repository/Config/UnitRepositoryQuery.php
  4. +3
    -3
      Repository/Credit/CreditHistoryRepositoryQuery.php
  5. +1
    -1
      Repository/Distribution/DistributionRepositoryQuery.php
  6. +1
    -1
      Repository/File/DocumentRepositoryQuery.php
  7. +1
    -1
      Repository/Merchant/MerchantRepositoryQuery.php
  8. +1
    -1
      Repository/Order/OrderPaymentRepositoryQuery.php
  9. +1
    -1
      Repository/Order/OrderProductReductionCatalogRepositoryQuery.php
  10. +1
    -1
      Repository/Order/OrderProductRefundRepositoryQuery.php
  11. +4
    -4
      Repository/Order/OrderProductRepositoryQuery.php
  12. +1
    -1
      Repository/Order/OrderReductionCartRepositoryQuery.php
  13. +1
    -1
      Repository/Order/OrderReductionCreditRepositoryQuery.php
  14. +1
    -1
      Repository/Order/OrderRefundRepositoryQuery.php
  15. +26
    -26
      Repository/Order/OrderShopRepositoryQuery.php
  16. +1
    -1
      Repository/Order/OrderShopStore.php
  17. +1
    -1
      Repository/Order/OrderStatusHistoryRepositoryQuery.php
  18. +1
    -1
      Repository/Order/OrderStatusRepositoryQuery.php
  19. +1
    -1
      Repository/PointSale/PointSaleRepositoryQuery.php
  20. +3
    -3
      Repository/Product/ProductCategoryRepositoryQuery.php
  21. +30
    -31
      Repository/Product/ProductFamilyRepositoryQuery.php
  22. +1
    -1
      Repository/Product/ProductFamilySectionPropertyRepositoryQuery.php
  23. +18
    -18
      Repository/Product/ProductRepositoryQuery.php
  24. +1
    -1
      Repository/Product/QualityLabelRepositoryQuery.php
  25. +1
    -1
      Repository/Reduction/ReductionCartRepositoryQuery.php
  26. +11
    -11
      Repository/Reduction/ReductionCatalogRepositoryQuery.php
  27. +1
    -1
      Repository/Reduction/ReductionCreditRepositoryQuery.php
  28. +1
    -1
      Repository/Section/OpeningRepositoryQuery.php
  29. +1
    -1
      Repository/Section/SectionRepositoryQuery.php
  30. +1
    -1
      Repository/Setting/MerchantSettingRepositoryQuery.php
  31. +1
    -1
      Repository/Setting/SectionSettingRepositoryQuery.php
  32. +1
    -1
      Repository/User/UserMerchantRepositoryQuery.php
  33. +1
    -1
      Repository/User/UserPointSaleRepositoryQuery.php
  34. +3
    -3
      Repository/User/UserRepositoryQuery.php
  35. +1
    -1
      Repository/User/VisitorRepositoryQuery.php

+ 1
- 1
Repository/Address/AddressRepositoryQuery.php View File



public function __construct(AddressRepository $repository, PaginatorInterface $paginator) public function __construct(AddressRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'address', $paginator);
} }


public function filterByUser(UserInterface $user) public function filterByUser(UserInterface $user)

+ 1
- 1
Repository/Config/TaxRateRepositoryQuery.php View File

{ {
public function __construct(TaxRateRepository $repository, PaginatorInterface $paginator) public function __construct(TaxRateRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'taxRate', $paginator);
} }
} }

+ 1
- 1
Repository/Config/UnitRepositoryQuery.php View File

{ {
public function __construct(UnitRepository $repository, PaginatorInterface $paginator) public function __construct(UnitRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'unit', $paginator);
} }
} }

+ 3
- 3
Repository/Credit/CreditHistoryRepositoryQuery.php View File



public function __construct(CreditHistoryRepository $repository, PaginatorInterface $paginator) public function __construct(CreditHistoryRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'creditHistory', $paginator);
} }


public function joinUserMerchant(): self public function joinUserMerchant(): self
$this->isJoinUserMerchants = true; $this->isJoinUserMerchants = true;


return $this return $this
->innerJoin('.userMerchant', 'um');
->innerJoin('.userMerchant', 'userMerchant');
} }
return $this; return $this;
} }
{ {
$this->joinUserMerchant(); $this->joinUserMerchant();
return $this return $this
->andWhereMerchant('um', $merchant);
->andWhereMerchant('userMerchant', $merchant);
} }


public function filterByUserMerchant(UserMerchantInterface $userMerchant): self public function filterByUserMerchant(UserMerchantInterface $userMerchant): self

+ 1
- 1
Repository/Distribution/DistributionRepositoryQuery.php View File



public function __construct(DistributionRepository $repository, PaginatorInterface $paginator) public function __construct(DistributionRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'd', $paginator);
parent::__construct($repository, 'distribution', $paginator);
} }


public function filterByYear(int $year): self public function filterByYear(int $year): self

+ 1
- 1
Repository/File/DocumentRepositoryQuery.php View File



public function __construct(DocumentRepository $repository, PaginatorInterface $paginator) public function __construct(DocumentRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'document', $paginator);
} }


public function filterByType($type) public function filterByType($type)

+ 1
- 1
Repository/Merchant/MerchantRepositoryQuery.php View File

{ {
public function __construct(MerchantRepository $repository, PaginatorInterface $paginator) public function __construct(MerchantRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'merchant', $paginator);
} }


} }

+ 1
- 1
Repository/Order/OrderPaymentRepositoryQuery.php View File

{ {
public function __construct(OrderPaymentRepository $repository, PaginatorInterface $paginator) public function __construct(OrderPaymentRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderPayment', $paginator);
} }
} }

+ 1
- 1
Repository/Order/OrderProductReductionCatalogRepositoryQuery.php View File

{ {
public function __construct(OrderProductReductionCatalogRepository $repository, PaginatorInterface $paginator) public function __construct(OrderProductReductionCatalogRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderProductReductionCatalog', $paginator);
} }
} }

+ 1
- 1
Repository/Order/OrderProductRefundRepositoryQuery.php View File

{ {
public function __construct(OrderProductRefundRepository $repository, PaginatorInterface $paginator) public function __construct(OrderProductRefundRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderProductRefund', $paginator);
} }
} }

+ 4
- 4
Repository/Order/OrderProductRepositoryQuery.php View File



public function __construct(OrderProductRepository $repository, PaginatorInterface $paginator) public function __construct(OrderProductRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderProduct', $paginator);
} }


public function filterByOrderShop(OrderShopInterface $orderShop): self public function filterByOrderShop(OrderShopInterface $orderShop): self
$this->joinOrderStatus(); $this->joinOrderStatus();


return $this return $this
->andWhere('os.alias IN (:alias)')
->andWhere('orderStatus.alias IN (:alias)')
->setParameter('alias', $status); ->setParameter('alias', $status);
} }


public function selectCount(): self public function selectCount(): self
{ {
return $this return $this
->select('count(r.id) as total');
->select('count(orderProduct.id) as total');
} }


public function joinProduct(): self public function joinProduct(): self
$this->isJoinOrderStatus = true; $this->isJoinOrderStatus = true;


return $this return $this
->leftJoin('orderShop.orderStatus', 'os');
->leftJoin('orderShop.orderStatus', 'orderStatus');
} }
return $this; return $this;
} }

+ 1
- 1
Repository/Order/OrderReductionCartRepositoryQuery.php View File

{ {
public function __construct(OrderReductionCartRepository $repository, PaginatorInterface $paginator) public function __construct(OrderReductionCartRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderReductionCart', $paginator);
} }
} }

+ 1
- 1
Repository/Order/OrderReductionCreditRepositoryQuery.php View File

{ {
public function __construct(OrderReductionCreditRepository $repository, PaginatorInterface $paginator) public function __construct(OrderReductionCreditRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderReductionCredit', $paginator);
} }
} }

+ 1
- 1
Repository/Order/OrderRefundRepositoryQuery.php View File

{ {
public function __construct(OrderRefundRepository $repository, PaginatorInterface $paginator) public function __construct(OrderRefundRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderRefund', $paginator);
} }
} }

+ 26
- 26
Repository/Order/OrderShopRepositoryQuery.php View File

protected bool $isJoinProduct = false; protected bool $isJoinProduct = false;
protected bool $isJoinDistribution = false; protected bool $isJoinDistribution = false;
protected bool $isJoinProductFamily = false; protected bool $isJoinProductFamily = false;
protected bool $isJoinOrderProduct = false;
protected bool $isJoinOrderProducts = false;
protected bool $isJoinOrderReductionCredits = false; protected bool $isJoinOrderReductionCredits = false;
protected bool $isJoinOrderReductionCarts = false; protected bool $isJoinOrderReductionCarts = false;
protected bool $isJoinOrderStatus = false; protected bool $isJoinOrderStatus = false;


public function __construct(OrderShopRepository $repository, PaginatorInterface $paginator) public function __construct(OrderShopRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderShop', $paginator);
} }




{ {
return $this return $this
->select( ->select(
'SUM(DISTINCT(r.statTotalWithTax)) as total'
'SUM(DISTINCT(orderShop.statTotalWithTax)) as total'
); );
} }


public function selectSumQuantityOrder(): self public function selectSumQuantityOrder(): self
{ {
$this->joinOrderProduct();
$this->joinOrderProducts();
return $this return $this
->select( ->select(
'SUM(orderProduct.quantityOrder) as quantity'
'SUM(orderProducts.quantityOrder) as quantity'
); );
} }


$this->joinDistribution(); $this->joinDistribution();
return $this return $this
->select( ->select(
'SUM(orderProduct.quantityOrder) as quantity, distribution.cycleNumber as cycleNumber, distribution.year as year , product.id as productId'
'SUM(orderProducts.quantityOrder) as quantity, distribution.cycleNumber as cycleNumber, distribution.year as year , product.id as productId'
); );
} }


public function selectCountUser(): self public function selectCountUser(): self
{ {
return $this return $this
->select('count(DISTINCT(r.user)) as total');
->select('count(DISTINCT(orderShop.user)) as total');
} }




public function selectCount(): self public function selectCount(): self
{ {
return $this return $this
->select('count(DISTINCT(r.id)) as total');
->select('count(DISTINCT(orderShop.id)) as total');
} }


public function joinUser(): self public function joinUser(): self
$this->joinOrderStatus(); $this->joinOrderStatus();


return $this return $this
->andWhere('os.alias IN (:alias)')
->andWhere('orderStatus.alias IN (:alias)')
->setParameter('alias', $status); ->setParameter('alias', $status);
} }




public function filterByProducts(array $products): self public function filterByProducts(array $products): self
{ {
$this->joinOrderProduct();
$this->joinOrderProducts();


return $this return $this
->andWhere('product.id IN(:products)') ->andWhere('product.id IN(:products)')
$this->joinProduct(); $this->joinProduct();


return $this return $this
->andWhere('orderProduct.product = :product')
->andWhere('orderProducts.product = :product')
->setParameter('product', $product); ->setParameter('product', $product);
} }


$this->joinOrderStatus(); $this->joinOrderStatus();


return $this return $this
->andWhere('os.alias IN (:alias)')
->andWhere('orderStatus.alias IN (:alias)')
->setParameter('alias', $statusArray); ->setParameter('alias', $statusArray);
} }


$this->joinOrderReductionCredits(); $this->joinOrderReductionCredits();


return $this return $this
->andWhere('orc.reductionCredit = :reductionCredit')
->andWhere('orderReductionCredits.reductionCredit = :reductionCredit')
->setParameter('reductionCredit', $reductionCredit); ->setParameter('reductionCredit', $reductionCredit);
} }


$this->joinOrderReductionCarts(); $this->joinOrderReductionCarts();


return $this return $this
->andWhere('orcart.reductionCart = :reductionCart')
->andWhere('orderReductionCarts.reductionCart = :reductionCart')
->setParameter('reductionCart', $reductionCart); ->setParameter('reductionCart', $reductionCart);
} }


{ {
$this->joinOrderReductionCarts(); $this->joinOrderReductionCarts();


return $this->addSelect('orcart');
return $this->addSelect('orderReductionCarts');
} }




public function joinOrderProduct(bool $addSelect = false): self
public function joinOrderProducts(bool $addSelect = false): self
{ {
if (!$this->isJoinOrderProduct) {
$this->isJoinOrderProduct = true;
if (!$this->isJoinOrderProducts) {
$this->isJoinOrderProducts = true;


$this->leftJoin('.orderProducts', 'orderProduct');
$this->leftJoin('.orderProducts', 'orderProducts');


if ($addSelect) { if ($addSelect) {
$this->addSelect('orderProduct');
$this->addSelect('orderProducts');
} }
} }
return $this; return $this;


public function joinProduct(bool $addSelect = false): self public function joinProduct(bool $addSelect = false): self
{ {
$this->joinOrderProduct($addSelect);
$this->joinOrderProducts($addSelect);
if (!$this->isJoinProduct) { if (!$this->isJoinProduct) {
$this->isJoinProduct = true; $this->isJoinProduct = true;


$this->leftJoin('orderProduct.product', 'product');
$this->leftJoin('orderProducts.product', 'product');


if ($addSelect) { if ($addSelect) {
$this->addSelect('product'); $this->addSelect('product');
$this->isJoinOrderReductionCredits = true; $this->isJoinOrderReductionCredits = true;


return $this return $this
->innerJoin('.orderReductionCredits', 'orc');
->innerJoin('.orderReductionCredits', 'orderReductionCredits');
} }
return $this; return $this;
} }
$this->isJoinOrderStatus = true; $this->isJoinOrderStatus = true;


return $this return $this
->leftJoin('.orderStatus', 'os');
->leftJoin('.orderStatus', 'orderStatus');
} }
return $this; return $this;
} }
$this->isJoinOrderReductionCarts = true; $this->isJoinOrderReductionCarts = true;


return $this return $this
->leftJoin('.orderReductionCarts', 'orcart');
->leftJoin('.orderReductionCarts', 'orderReductionCarts');
} }
return $this; return $this;
} }
$this->isJoinDeliveryPointSale = true; $this->isJoinDeliveryPointSale = true;


return $this return $this
->leftJoin('.deliveryPointSale', 'pointSale');
->leftJoin('.deliveryPointSale', 'deliveryPointSale');
} }
return $this; return $this;
} }

+ 1
- 1
Repository/Order/OrderShopStore.php View File



public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
$query->joinOrderProduct(true);
$query->joinOrderProducts(true);
return $query; return $query;
} }



+ 1
- 1
Repository/Order/OrderStatusHistoryRepositoryQuery.php View File

{ {
public function __construct(OrderStatusHistoryRepository $repository, PaginatorInterface $paginator) public function __construct(OrderStatusHistoryRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderStatusHistory', $paginator);
} }
} }

+ 1
- 1
Repository/Order/OrderStatusRepositoryQuery.php View File

{ {
public function __construct(OrderStatusRepository $repository, PaginatorInterface $paginator) public function __construct(OrderStatusRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderStatus', $paginator);
} }


public function filterByAlias(string $alias) public function filterByAlias(string $alias)

+ 1
- 1
Repository/PointSale/PointSaleRepositoryQuery.php View File



public function __construct(PointSaleRepository $repository, PaginatorInterface $paginator) public function __construct(PointSaleRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'pointSale', $paginator);
} }


public function filterByUser(UserInterface $user): self public function filterByUser(UserInterface $user): self

+ 3
- 3
Repository/Product/ProductCategoryRepositoryQuery.php View File



public function __construct(ProductCategoryRepository $repository, PaginatorInterface $paginator) public function __construct(ProductCategoryRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'productCategory', $paginator);
} }


public function joinProductFamilies(): self public function joinProductFamilies(): self
$this->isJoinProductFamilies = true; $this->isJoinProductFamilies = true;


return $this return $this
->innerJoin('.productFamilies', 'pf');
->innerJoin('.productFamilies', 'productFamilies');
} }


return $this; return $this;
{ {
$this->joinProductFamilies(); $this->joinProductFamilies();


return $this->andWhere('pf.status = 1');
return $this->andWhere('productFamilies.status = 1');
} }


} }

+ 30
- 31
Repository/Product/ProductFamilyRepositoryQuery.php View File



public function __construct(ProductFamilyRepository $repository, PaginatorInterface $paginator) public function __construct(ProductFamilyRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'pf', $paginator);
parent::__construct($repository, 'productFamily', $paginator);
} }


public function joinProductFamilySectionProperties(bool $addSelect = true): self public function joinProductFamilySectionProperties(bool $addSelect = true): self
if (!$this->isJoinProductFamilySectionProperties) { if (!$this->isJoinProductFamilySectionProperties) {
$this->isJoinProductFamilySectionProperties = true; $this->isJoinProductFamilySectionProperties = true;


$this->leftJoin('.productFamilySectionProperties', 'pfsp');
$this->leftJoin('.productFamilySectionProperties', 'productFamilySectionProperties');
if ($addSelect) { if ($addSelect) {
$this->addSelect('pfsp');
$this->addSelect('productFamilySectionProperties');
} }
} }
return $this; return $this;
if (!$this->isJoinQualityLabels) { if (!$this->isJoinQualityLabels) {
$this->isJoinQualityLabels = true; $this->isJoinQualityLabels = true;


$this->leftJoin('.qualityLabels', 'pfql');
$this->leftJoin('.qualityLabels', 'qualityLabels');
if ($addSelect) { if ($addSelect) {
$this->addSelect('pfql');
$this->addSelect('qualityLabels');
} }
} }
return $this; return $this;
if (!$this->isJoinSections) { if (!$this->isJoinSections) {
$this->isJoinSections = true; $this->isJoinSections = true;


$this->leftJoin('pfsp.section', 'section');
$this->leftJoin('productFamilySectionProperties.section', 'section');
if ($addSelect) { if ($addSelect) {
$this->addSelect('section'); $this->addSelect('section');
} }
return $this; return $this;
} }


public function filterBySection(SectionInterface $section,bool $addSelectProductFamilySectionProperties = true)
public function filterBySection(SectionInterface $section, bool $addSelectProductFamilySectionProperties = true)
{ {
$this->joinProductFamilySectionProperties($addSelectProductFamilySectionProperties); $this->joinProductFamilySectionProperties($addSelectProductFamilySectionProperties);
$this->andWhereSection('pfsp', $section);
$this->andWhere('pfsp.status = 1');
$this->andWhereSection('productFamilySectionProperties', $section);
$this->andWhere('productFamilySectionProperties.status = 1');
} }


public function filterByMerchantViaSection(MerchantInterface $merchant) public function filterByMerchantViaSection(MerchantInterface $merchant)
$this->joinProductFamilySectionProperties(false); $this->joinProductFamilySectionProperties(false);
$this->joinSections(false); $this->joinSections(false);
$this->andWhereMerchant('section', $merchant); $this->andWhereMerchant('section', $merchant);
$this->andWhere('pfsp.status = 1');
$this->andWhere('productFamilySectionProperties.status = 1');
} }




public function selectCount(): self public function selectCount(): self
{ {
return $this->select('count(pf.id)');
return $this->select('count(productFamily.id)');
} }


public function selectProductCategories(): self public function selectProductCategories(): self
public function filterLikeBehaviorStockCycle(string $behaviorStockCycle): self public function filterLikeBehaviorStockCycle(string $behaviorStockCycle): self
{ {
return $this return $this
->andWhere('.behaviorStockCycle LIKE :behaviorStockCycle')
->setParameter('behaviorStockCycle', $behaviorStockCycle);
->andWhere('.behaviorStockCycle LIKE :behaviorStockCycle')
->setParameter('behaviorStockCycle', $behaviorStockCycle);
} }


public function filterByProductCategory(ProductCategoryInterface $category): self public function filterByProductCategory(ProductCategoryInterface $category): self
{ {
$this->joinProductCategories(); $this->joinProductCategories();
return $this return $this
->andWhere(':category MEMBER OF .productCategories')
->setParameter('category', $category->getId());
->andWhere(':category MEMBER OF .productCategories')
->setParameter('category', $category->getId());
} }




} }


return $this->andWhere(':now <= .propertyNoveltyExpirationDate') return $this->andWhere(':now <= .propertyNoveltyExpirationDate')
->setParameter('now', $dateTime);
->setParameter('now', $dateTime);
} }


public function filterIsOrganicLabel(): self public function filterIsOrganicLabel(): self
public function filterIsNovelty() public function filterIsNovelty()
{ {
return $this->andWhere(':now <= .propertyNoveltyExpirationDate') return $this->andWhere(':now <= .propertyNoveltyExpirationDate')
->setParameter('now', new \DateTime()) ;
->setParameter('now', new \DateTime());
} }


public function filterByTerms($terms): self public function filterByTerms($terms): self
{ {
$this->andWhere('.title LIKE :terms OR cat.title LIKE :terms');
$this->setParameter(':terms', '%'.$terms.'%') ;
$this->andWhere('.title LIKE :terms OR productCategories.title LIKE :terms');
$this->setParameter(':terms', '%' . $terms . '%');
return $this; return $this;
} }


if (!$this->isJoinProductCategories) { if (!$this->isJoinProductCategories) {
$this->isJoinProductCategories = true; $this->isJoinProductCategories = true;


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


public function selectProducts(): self public function selectProducts(): self
{ {
$this->joinProducts();

return $this->addSelect('products');
return $this->joinProducts(true);
} }


public function joinProducts(): self
public function joinProducts(bool $addSelect = true): self
{ {
if (!$this->isJoinProducts) { if (!$this->isJoinProducts) {
$this->isJoinProducts = true; $this->isJoinProducts = true;


return $this
->innerJoin('.products', 'pfp')
->addSelect('pfp')
;
$this->innerJoin('.products', 'products');
if ($addSelect) {
$this->addSelect('products');
}
} }
return $this; return $this;
} }

+ 1
- 1
Repository/Product/ProductFamilySectionPropertyRepositoryQuery.php View File



public function __construct(ProductFamilySectionPropertyRepository $repository, PaginatorInterface $paginator) public function __construct(ProductFamilySectionPropertyRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'pfsp', $paginator);
parent::__construct($repository, 'productFamilySectionProperty', $paginator);
} }


public function filterByProductFamily(ProductFamilyInterface $productFamily): self public function filterByProductFamily(ProductFamilyInterface $productFamily): self

+ 18
- 18
Repository/Product/ProductRepositoryQuery.php View File



public function __construct(ProductRepository $repository, PaginatorInterface $paginator) public function __construct(ProductRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'product', $paginator);
} }
public function orderByDefault(): \Lc\SovBundle\Repository\AbstractRepositoryQuery public function orderByDefault(): \Lc\SovBundle\Repository\AbstractRepositoryQuery
{ {
$this->isJoinProductFamily = true; $this->isJoinProductFamily = true;


return $this return $this
->innerJoin('.productFamily', 'pf')
->addSelect('pf');
->innerJoin('.productFamily', 'productFamily')
->addSelect('productFamily');
} }
return $this; return $this;
} }
public function filterBySection(SectionInterface $section):self public function filterBySection(SectionInterface $section):self
{ {
$this->joinProductFamilySectionProperties(false); $this->joinProductFamilySectionProperties(false);
$this->andWhereSection('pfsp', $section);
$this->andWhere('pfsp.status = 1');
$this->andWhereSection('productFamilySectionProperties', $section);
$this->andWhere('productFamilySectionProperties.status = 1');


return $this; return $this;
} }
if (!$this->isJoinProductFamilySectionProperties) { if (!$this->isJoinProductFamilySectionProperties) {
$this->isJoinProductFamilySectionProperties = true; $this->isJoinProductFamilySectionProperties = true;


$this->leftJoin('pf.productFamilySectionProperties', 'pfsp');
$this->leftJoin('productFamily.productFamilySectionProperties', 'productFamilySectionProperties');
if ($addSelect) { if ($addSelect) {
$this->addSelect('pfsp');
$this->addSelect('productFamilySectionProperties');
} }
} }
return $this; return $this;
public function filterIsOnline():self public function filterIsOnline():self
{ {
$this->joinProductFamily(); $this->joinProductFamily();
$this->andWhereStatus('pf', 1);
$this->andWhereStatus('productFamily', 1);
$this->andWhereStatus($this->id, 1); $this->andWhereStatus($this->id, 1);
return $this; return $this;
} }
$this->query->expr()->orX( $this->query->expr()->orX(
$this->query->expr()->andX( $this->query->expr()->andX(
$this->query->expr()->orX( $this->query->expr()->orX(
'pf.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'pf.behaviorCountStock LIKE :behaviorCountStockByMeasure'
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
), ),
'pf.availableQuantity < 0 '
'productFamily.availableQuantity < 0 '
), ),
$this->query->expr()->andX( $this->query->expr()->andX(
'pf.behaviorCountStock LIKE :behaviorCountStockByProduct',
'r.availableQuantity < 0 '
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantity < 0 '
) )
) )
); );
$this->query->expr()->orX( $this->query->expr()->orX(
$this->query->expr()->andX( $this->query->expr()->andX(
$this->query->expr()->orX( $this->query->expr()->orX(
'pf.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'pf.behaviorCountStock LIKE :behaviorCountStockByMeasure'
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
), ),
'pf.availableQuantitySupplier < 0 '
'productFamily.availableQuantitySupplier < 0 '
), ),
$this->query->expr()->andX( $this->query->expr()->andX(
'pf.behaviorCountStock LIKE :behaviorCountStockByProduct',
'r.availableQuantitySupplier < 0 '
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantitySupplier < 0 '
) )
) )
); );

+ 1
- 1
Repository/Product/QualityLabelRepositoryQuery.php View File

{ {
public function __construct(QualityLabelRepository $repository, PaginatorInterface $paginator) public function __construct(QualityLabelRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'qualityLabel', $paginator);
} }


public function orderByDefault(): AbstractRepositoryQuery public function orderByDefault(): AbstractRepositoryQuery

+ 1
- 1
Repository/Reduction/ReductionCartRepositoryQuery.php View File



public function __construct(ReductionCartRepository $repository, PaginatorInterface $paginator) public function __construct(ReductionCartRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'reductionCart', $paginator);
} }


public function filterByCode(string $code) public function filterByCode(string $code)

+ 11
- 11
Repository/Reduction/ReductionCatalogRepositoryQuery.php View File



public function __construct(ReductionCatalogRepository $repository, PaginatorInterface $paginator) public function __construct(ReductionCatalogRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'reductionCatalog', $paginator);
} }


public function joinUsers() public function joinUsers()
$this->isJoinUsers = true; $this->isJoinUsers = true;


return $this return $this
->leftJoin('.users', 'pf_users')
->addSelect('pf_users') ;
->leftJoin('.users', 'users')
->addSelect('users') ;
} }
return $this; return $this;
} }
$this->isJoinGroupUsers = true; $this->isJoinGroupUsers = true;


return $this return $this
->leftJoin('.groupUsers', 'pf_groupusers')
->addSelect('pf_groupusers') ;
->leftJoin('.groupUsers', 'groupusers')
->addSelect('groupusers') ;
} }
return $this; return $this;
} }
$this->isJoinProductFamilies = true; $this->isJoinProductFamilies = true;


return $this return $this
->leftJoin('.productFamilies', 'pfs')
->addSelect('pfs') ;
->leftJoin('.productFamilies', 'productFamilies')
->addSelect('productFamilies') ;
} }
return $this; return $this;
} }
$this->isJoinProductFamily = true; $this->isJoinProductFamily = true;


return $this return $this
->leftJoin('.productFamily', 'pf')
->addSelect('pf') ;
->leftJoin('.productFamily', 'productFamily')
->addSelect('productFamily') ;
} }
return $this; return $this;
} }
$this->isJoinProductCategories = true; $this->isJoinProductCategories = true;


return $this return $this
->leftJoin('.productCategories', 'pcs')
->addSelect('pcs') ;
->leftJoin('.productCategories', 'productCategories')
->addSelect('productCategories') ;
} }
return $this; return $this;
} }

+ 1
- 1
Repository/Reduction/ReductionCreditRepositoryQuery.php View File



public function __construct(ReductionCreditRepository $repository, PaginatorInterface $paginator) public function __construct(ReductionCreditRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'reductionCredit', $paginator);
} }


public function filterByUser(UserInterface $user) public function filterByUser(UserInterface $user)

+ 1
- 1
Repository/Section/OpeningRepositoryQuery.php View File



public function __construct(OpeningRepository $repository, PaginatorInterface $paginator) public function __construct(OpeningRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'opening', $paginator);
} }
} }

+ 1
- 1
Repository/Section/SectionRepositoryQuery.php View File



public function __construct(SectionRepository $repository, PaginatorInterface $paginator) public function __construct(SectionRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'section', $paginator);
} }


public function filterByIsDefault(bool $isDefault) public function filterByIsDefault(bool $isDefault)

+ 1
- 1
Repository/Setting/MerchantSettingRepositoryQuery.php View File



public function __construct(MerchantSettingRepository $repository, PaginatorInterface $paginator) public function __construct(MerchantSettingRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'merchantSetting', $paginator);
} }
} }

+ 1
- 1
Repository/Setting/SectionSettingRepositoryQuery.php View File



public function __construct(SectionSettingRepository $repository, PaginatorInterface $paginator) public function __construct(SectionSettingRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'sectionSetting', $paginator);
} }
} }

+ 1
- 1
Repository/User/UserMerchantRepositoryQuery.php View File



public function __construct(UserMerchantRepository $repository, PaginatorInterface $paginator) public function __construct(UserMerchantRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'userMerchant', $paginator);
} }


public function filterByUser(UserInterface $user) public function filterByUser(UserInterface $user)

+ 1
- 1
Repository/User/UserPointSaleRepositoryQuery.php View File

{ {
public function __construct(UserPointSaleRepository $repository, PaginatorInterface $paginator) public function __construct(UserPointSaleRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'userPointSale', $paginator);
} }
} }

+ 3
- 3
Repository/User/UserRepositoryQuery.php View File

$this->isJoinUserMerchants = true; $this->isJoinUserMerchants = true;


return $this return $this
->innerJoin('.userMerchants', 'um');
->innerJoin('.userMerchants', 'userMerchants');
} }
return $this; return $this;
} }
{ {
$this->joinUserMerchants(); $this->joinUserMerchants();
return $this return $this
->andWhere('um.active = 1');
->andWhere('userMerchants.active = 1');
} }


public function filterByMerchant(Merchant $merchant): self public function filterByMerchant(Merchant $merchant): self
{ {
$this->joinUserMerchants(); $this->joinUserMerchants();
return $this return $this
->andWhere('um.merchant = :merchant')
->andWhere('userMerchants.merchant = :merchant')
->setParameter('merchant', $merchant); ->setParameter('merchant', $merchant);
} }
} }

+ 1
- 1
Repository/User/VisitorRepositoryQuery.php View File

{ {
public function __construct(VisitorRepository $repository, PaginatorInterface $paginator) public function __construct(VisitorRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'visitor', $paginator);
} }


public function filterByCookie(string $cookie = null) public function filterByCookie(string $cookie = null)

Loading…
Cancel
Save