瀏覽代碼

Correctifs divers

feature/export_comptable
Guillaume 4 年之前
父節點
當前提交
7b21053620
共有 2 個檔案被更改,包括 25 行新增7 行删除
  1. +0
    -1
      ShopBundle/Repository/ProductCategoryRepository.php
  2. +25
    -6
      ShopBundle/Repository/ProductFamilyRepository.php

+ 0
- 1
ShopBundle/Repository/ProductCategoryRepository.php 查看文件

@@ -39,7 +39,6 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit
$query->orderBy('e.position', 'ASC');

return $query->getQuery()->getResult();

}

public function findAllByParent($parentCategory, $withOffline = false, $withEmptyCategories = true)

+ 25
- 6
ShopBundle/Repository/ProductFamilyRepository.php 查看文件

@@ -19,20 +19,36 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
return ProductFamilyInterface::class;
}

public function joinRelations($query)
{
$query->leftJoin('e.productCategories', 'cat');
$query->addSelect('cat') ;

$query->innerJoin('e.products', 'pfp');
$query->addSelect('pfp') ;

$query->innerJoin('e.supplier', 'pfs');
$query->addSelect('pfs') ;

return $query ;
}

public function getProductFamiliesByCategory($category){
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query = $this->joinRelations($query) ;

$query->andWhere(':category MEMBER OF e.productCategories');
$query->andWhere('e.status = 1');
$query->setParameter('category', $category->getId());

return $query->getQuery()->getResult() ;
$query->andWhere('e.status = 1');

return $query->getQuery()->getResult() ;
}

public function getProductFamiliesNovelties(){
$query = $this->findByMerchantQuery();
$query = $this->joinRelations($query) ;

$query->andWhere('e.status = 1');
$query->andWhere(':now <= e.propertyNoveltyExpirationDate')
->setParameter('now', new \DateTime()) ;
@@ -42,7 +58,8 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor

public function getProductFamiliesLargeVolumes(){
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query = $this->joinRelations($query) ;

$query->andWhere('e.status = 1');
$query->andWhere('e.propertyLargeVolume = 1');

@@ -51,7 +68,8 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor

public function getProductFamiliesOrganics(){
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query = $this->joinRelations($query) ;

$query->andWhere('e.status = 1');
$query->andWhere('e.propertyOrganicLabel IS NOT NULL');

@@ -61,7 +79,8 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
public function findByTerms($terms, $maxResults = false)
{
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.productCategories', 'cat');
$query = $this->joinRelations($query) ;

$query->andWhere('e.status = 1');
$query->andWhere('e.title LIKE :terms');
$query->setParameter(':terms', '%'.$terms.'%') ;

Loading…
取消
儲存