瀏覽代碼

Refactoring repositoryQuery id d'entité

packProduct
Fabien Normand 2 年之前
父節點
當前提交
a3c464d030
共有 35 個檔案被更改,包括 125 行新增126 行删除
  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 查看文件

@@ -13,7 +13,7 @@ class AddressRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByUser(UserInterface $user)

+ 1
- 1
Repository/Config/TaxRateRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class TaxRateRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(TaxRateRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'taxRate', $paginator);
}
}

+ 1
- 1
Repository/Config/UnitRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class UnitRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(UnitRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'unit', $paginator);
}
}

+ 3
- 3
Repository/Credit/CreditHistoryRepositoryQuery.php 查看文件

@@ -16,7 +16,7 @@ class CreditHistoryRepositoryQuery extends AbstractRepositoryQuery

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

public function joinUserMerchant(): self
@@ -25,7 +25,7 @@ class CreditHistoryRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinUserMerchants = true;

return $this
->innerJoin('.userMerchant', 'um');
->innerJoin('.userMerchant', 'userMerchant');
}
return $this;
}
@@ -34,7 +34,7 @@ class CreditHistoryRepositoryQuery extends AbstractRepositoryQuery
{
$this->joinUserMerchant();
return $this
->andWhereMerchant('um', $merchant);
->andWhereMerchant('userMerchant', $merchant);
}

public function filterByUserMerchant(UserMerchantInterface $userMerchant): self

+ 1
- 1
Repository/Distribution/DistributionRepositoryQuery.php 查看文件

@@ -12,7 +12,7 @@ class DistributionRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByYear(int $year): self

+ 1
- 1
Repository/File/DocumentRepositoryQuery.php 查看文件

@@ -14,7 +14,7 @@ class DocumentRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByType($type)

+ 1
- 1
Repository/Merchant/MerchantRepositoryQuery.php 查看文件

@@ -9,7 +9,7 @@ class MerchantRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(MerchantRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'merchant', $paginator);
}

}

+ 1
- 1
Repository/Order/OrderPaymentRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderPaymentRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderPaymentRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderPayment', $paginator);
}
}

+ 1
- 1
Repository/Order/OrderProductReductionCatalogRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderProductReductionCatalogRepositoryQuery extends AbstractRepositoryQuer
{
public function __construct(OrderProductReductionCatalogRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderProductReductionCatalog', $paginator);
}
}

+ 1
- 1
Repository/Order/OrderProductRefundRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderProductRefundRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderProductRefundRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderProductRefund', $paginator);
}
}

+ 4
- 4
Repository/Order/OrderProductRepositoryQuery.php 查看文件

@@ -20,7 +20,7 @@ class OrderProductRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByOrderShop(OrderShopInterface $orderShop): self
@@ -58,7 +58,7 @@ class OrderProductRepositoryQuery extends AbstractRepositoryQuery
$this->joinOrderStatus();

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

@@ -66,7 +66,7 @@ class OrderProductRepositoryQuery extends AbstractRepositoryQuery
public function selectCount(): self
{
return $this
->select('count(r.id) as total');
->select('count(orderProduct.id) as total');
}

public function joinProduct(): self
@@ -110,7 +110,7 @@ class OrderProductRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinOrderStatus = true;

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

+ 1
- 1
Repository/Order/OrderReductionCartRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderReductionCartRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderReductionCartRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderReductionCart', $paginator);
}
}

+ 1
- 1
Repository/Order/OrderReductionCreditRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderReductionCreditRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderReductionCreditRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderReductionCredit', $paginator);
}
}

+ 1
- 1
Repository/Order/OrderRefundRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderRefundRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderRefundRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderRefund', $paginator);
}
}

+ 26
- 26
Repository/Order/OrderShopRepositoryQuery.php 查看文件

@@ -21,7 +21,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
protected bool $isJoinProduct = false;
protected bool $isJoinDistribution = false;
protected bool $isJoinProductFamily = false;
protected bool $isJoinOrderProduct = false;
protected bool $isJoinOrderProducts = false;
protected bool $isJoinOrderReductionCredits = false;
protected bool $isJoinOrderReductionCarts = false;
protected bool $isJoinOrderStatus = false;
@@ -32,7 +32,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery

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


@@ -40,16 +40,16 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
{
return $this
->select(
'SUM(DISTINCT(r.statTotalWithTax)) as total'
'SUM(DISTINCT(orderShop.statTotalWithTax)) as total'
);
}

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

@@ -60,7 +60,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->joinDistribution();
return $this
->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'
);
}

@@ -68,7 +68,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
public function selectCountUser(): self
{
return $this
->select('count(DISTINCT(r.user)) as total');
->select('count(DISTINCT(orderShop.user)) as total');
}


@@ -82,7 +82,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
public function selectCount(): self
{
return $this
->select('count(DISTINCT(r.id)) as total');
->select('count(DISTINCT(orderShop.id)) as total');
}

public function joinUser(): self
@@ -133,7 +133,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->joinOrderStatus();

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

@@ -146,7 +146,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery

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

return $this
->andWhere('product.id IN(:products)')
@@ -158,7 +158,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->joinProduct();

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

@@ -201,7 +201,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->joinOrderStatus();

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

@@ -210,7 +210,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->joinOrderReductionCredits();

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

@@ -219,7 +219,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->joinOrderReductionCarts();

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

@@ -251,19 +251,19 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
{
$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) {
$this->addSelect('orderProduct');
$this->addSelect('orderProducts');
}
}
return $this;
@@ -271,11 +271,11 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery

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

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

if ($addSelect) {
$this->addSelect('product');
@@ -318,7 +318,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinOrderReductionCredits = true;

return $this
->innerJoin('.orderReductionCredits', 'orc');
->innerJoin('.orderReductionCredits', 'orderReductionCredits');
}
return $this;
}
@@ -329,7 +329,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinOrderStatus = true;

return $this
->leftJoin('.orderStatus', 'os');
->leftJoin('.orderStatus', 'orderStatus');
}
return $this;
}
@@ -340,7 +340,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinOrderReductionCarts = true;

return $this
->leftJoin('.orderReductionCarts', 'orcart');
->leftJoin('.orderReductionCarts', 'orderReductionCarts');
}
return $this;
}
@@ -374,7 +374,7 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinDeliveryPointSale = true;

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

+ 1
- 1
Repository/Order/OrderShopStore.php 查看文件

@@ -104,7 +104,7 @@ class OrderShopStore extends AbstractStore

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


+ 1
- 1
Repository/Order/OrderStatusHistoryRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class OrderStatusHistoryRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderStatusHistoryRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderStatusHistory', $paginator);
}
}

+ 1
- 1
Repository/Order/OrderStatusRepositoryQuery.php 查看文件

@@ -9,7 +9,7 @@ class OrderStatusRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(OrderStatusRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'orderStatus', $paginator);
}

public function filterByAlias(string $alias)

+ 1
- 1
Repository/PointSale/PointSaleRepositoryQuery.php 查看文件

@@ -13,7 +13,7 @@ class PointSaleRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByUser(UserInterface $user): self

+ 3
- 3
Repository/Product/ProductCategoryRepositoryQuery.php 查看文件

@@ -15,7 +15,7 @@ class ProductCategoryRepositoryQuery extends AbstractRepositoryQuery

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

public function joinProductFamilies(): self
@@ -24,7 +24,7 @@ class ProductCategoryRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinProductFamilies = true;

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

return $this;
@@ -36,7 +36,7 @@ class ProductCategoryRepositoryQuery extends AbstractRepositoryQuery
{
$this->joinProductFamilies();

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

}

+ 30
- 31
Repository/Product/ProductFamilyRepositoryQuery.php 查看文件

@@ -19,7 +19,7 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery

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

public function joinProductFamilySectionProperties(bool $addSelect = true): self
@@ -27,9 +27,9 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
if (!$this->isJoinProductFamilySectionProperties) {
$this->isJoinProductFamilySectionProperties = true;

$this->leftJoin('.productFamilySectionProperties', 'pfsp');
$this->leftJoin('.productFamilySectionProperties', 'productFamilySectionProperties');
if ($addSelect) {
$this->addSelect('pfsp');
$this->addSelect('productFamilySectionProperties');
}
}
return $this;
@@ -40,9 +40,9 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
if (!$this->isJoinQualityLabels) {
$this->isJoinQualityLabels = true;

$this->leftJoin('.qualityLabels', 'pfql');
$this->leftJoin('.qualityLabels', 'qualityLabels');
if ($addSelect) {
$this->addSelect('pfql');
$this->addSelect('qualityLabels');
}
}
return $this;
@@ -53,7 +53,7 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
if (!$this->isJoinSections) {
$this->isJoinSections = true;

$this->leftJoin('pfsp.section', 'section');
$this->leftJoin('productFamilySectionProperties.section', 'section');
if ($addSelect) {
$this->addSelect('section');
}
@@ -61,11 +61,11 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
return $this;
}

public function filterBySection(SectionInterface $section,bool $addSelectProductFamilySectionProperties = true)
public function filterBySection(SectionInterface $section, bool $addSelectProductFamilySectionProperties = true)
{
$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)
@@ -73,13 +73,13 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
$this->joinProductFamilySectionProperties(false);
$this->joinSections(false);
$this->andWhereMerchant('section', $merchant);
$this->andWhere('pfsp.status = 1');
$this->andWhere('productFamilySectionProperties.status = 1');
}


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

public function selectProductCategories(): self
@@ -92,16 +92,16 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
public function filterLikeBehaviorStockCycle(string $behaviorStockCycle): self
{
return $this
->andWhere('.behaviorStockCycle LIKE :behaviorStockCycle')
->setParameter('behaviorStockCycle', $behaviorStockCycle);
->andWhere('.behaviorStockCycle LIKE :behaviorStockCycle')
->setParameter('behaviorStockCycle', $behaviorStockCycle);
}

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


@@ -112,7 +112,7 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
}

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

public function filterIsOrganicLabel(): self
@@ -123,13 +123,13 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
public function filterIsNovelty()
{
return $this->andWhere(':now <= .propertyNoveltyExpirationDate')
->setParameter('now', new \DateTime()) ;
->setParameter('now', new \DateTime());
}

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;
}

@@ -143,30 +143,29 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
if (!$this->isJoinProductCategories) {
$this->isJoinProductCategories = true;

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

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) {
$this->isJoinProducts = true;

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

+ 1
- 1
Repository/Product/ProductFamilySectionPropertyRepositoryQuery.php 查看文件

@@ -13,7 +13,7 @@ class ProductFamilySectionPropertyRepositoryQuery extends AbstractRepositoryQuer

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

public function filterByProductFamily(ProductFamilyInterface $productFamily): self

+ 18
- 18
Repository/Product/ProductRepositoryQuery.php 查看文件

@@ -16,7 +16,7 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery

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

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

return $this;
}
@@ -50,9 +50,9 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
if (!$this->isJoinProductFamilySectionProperties) {
$this->isJoinProductFamilySectionProperties = true;

$this->leftJoin('pf.productFamilySectionProperties', 'pfsp');
$this->leftJoin('productFamily.productFamilySectionProperties', 'productFamilySectionProperties');
if ($addSelect) {
$this->addSelect('pfsp');
$this->addSelect('productFamilySectionProperties');
}
}
return $this;
@@ -62,7 +62,7 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
public function filterIsOnline():self
{
$this->joinProductFamily();
$this->andWhereStatus('pf', 1);
$this->andWhereStatus('productFamily', 1);
$this->andWhereStatus($this->id, 1);
return $this;
}
@@ -75,14 +75,14 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
$this->query->expr()->orX(
$this->query->expr()->andX(
$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(
'pf.behaviorCountStock LIKE :behaviorCountStockByProduct',
'r.availableQuantity < 0 '
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantity < 0 '
)
)
);
@@ -102,14 +102,14 @@ class ProductRepositoryQuery extends AbstractRepositoryQuery
$this->query->expr()->orX(
$this->query->expr()->andX(
$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(
'pf.behaviorCountStock LIKE :behaviorCountStockByProduct',
'r.availableQuantitySupplier < 0 '
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'product.availableQuantitySupplier < 0 '
)
)
);

+ 1
- 1
Repository/Product/QualityLabelRepositoryQuery.php 查看文件

@@ -9,7 +9,7 @@ class QualityLabelRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(QualityLabelRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'qualityLabel', $paginator);
}

public function orderByDefault(): AbstractRepositoryQuery

+ 1
- 1
Repository/Reduction/ReductionCartRepositoryQuery.php 查看文件

@@ -13,7 +13,7 @@ class ReductionCartRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByCode(string $code)

+ 11
- 11
Repository/Reduction/ReductionCatalogRepositoryQuery.php 查看文件

@@ -21,7 +21,7 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery

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

public function joinUsers()
@@ -30,8 +30,8 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinUsers = true;

return $this
->leftJoin('.users', 'pf_users')
->addSelect('pf_users') ;
->leftJoin('.users', 'users')
->addSelect('users') ;
}
return $this;
}
@@ -42,8 +42,8 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinGroupUsers = true;

return $this
->leftJoin('.groupUsers', 'pf_groupusers')
->addSelect('pf_groupusers') ;
->leftJoin('.groupUsers', 'groupusers')
->addSelect('groupusers') ;
}
return $this;
}
@@ -54,8 +54,8 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinProductFamilies = true;

return $this
->leftJoin('.productFamilies', 'pfs')
->addSelect('pfs') ;
->leftJoin('.productFamilies', 'productFamilies')
->addSelect('productFamilies') ;
}
return $this;
}
@@ -66,8 +66,8 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinProductFamily = true;

return $this
->leftJoin('.productFamily', 'pf')
->addSelect('pf') ;
->leftJoin('.productFamily', 'productFamily')
->addSelect('productFamily') ;
}
return $this;
}
@@ -78,8 +78,8 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery
$this->isJoinProductCategories = true;

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

+ 1
- 1
Repository/Reduction/ReductionCreditRepositoryQuery.php 查看文件

@@ -17,7 +17,7 @@ class ReductionCreditRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByUser(UserInterface $user)

+ 1
- 1
Repository/Section/OpeningRepositoryQuery.php 查看文件

@@ -12,6 +12,6 @@ class OpeningRepositoryQuery extends AbstractRepositoryQuery

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

+ 1
- 1
Repository/Section/SectionRepositoryQuery.php 查看文件

@@ -12,7 +12,7 @@ class SectionRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByIsDefault(bool $isDefault)

+ 1
- 1
Repository/Setting/MerchantSettingRepositoryQuery.php 查看文件

@@ -12,6 +12,6 @@ class MerchantSettingRepositoryQuery extends AbstractRepositoryQuery

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

+ 1
- 1
Repository/Setting/SectionSettingRepositoryQuery.php 查看文件

@@ -12,6 +12,6 @@ class SectionSettingRepositoryQuery extends AbstractRepositoryQuery

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

+ 1
- 1
Repository/User/UserMerchantRepositoryQuery.php 查看文件

@@ -13,7 +13,7 @@ class UserMerchantRepositoryQuery extends AbstractRepositoryQuery

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

public function filterByUser(UserInterface $user)

+ 1
- 1
Repository/User/UserPointSaleRepositoryQuery.php 查看文件

@@ -9,6 +9,6 @@ class UserPointSaleRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(UserPointSaleRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'userPointSale', $paginator);
}
}

+ 3
- 3
Repository/User/UserRepositoryQuery.php 查看文件

@@ -19,7 +19,7 @@ class UserRepositoryQuery extends SovUserRepositoryQuery
$this->isJoinUserMerchants = true;

return $this
->innerJoin('.userMerchants', 'um');
->innerJoin('.userMerchants', 'userMerchants');
}
return $this;
}
@@ -28,14 +28,14 @@ class UserRepositoryQuery extends SovUserRepositoryQuery
{
$this->joinUserMerchants();
return $this
->andWhere('um.active = 1');
->andWhere('userMerchants.active = 1');
}

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

+ 1
- 1
Repository/User/VisitorRepositoryQuery.php 查看文件

@@ -9,7 +9,7 @@ class VisitorRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(VisitorRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'visitor', $paginator);
}

public function filterByCookie(string $cookie = null)

Loading…
取消
儲存