Pārlūkot izejas kodu

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Fab pirms 4 gadiem
vecāks
revīzija
c30ef94bde
3 mainītis faili ar 20 papildinājumiem un 13 dzēšanām
  1. +2
    -2
      ShopBundle/Model/ProductFamily.php
  2. +7
    -4
      ShopBundle/Repository/ProductFamilyRepository.php
  3. +11
    -7
      ShopBundle/Repository/ReductionCatalogRepository.php

+ 2
- 2
ShopBundle/Model/ProductFamily.php Parādīt failu

@@ -36,7 +36,7 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies", fetch="EAGER")
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies")
*/
protected $productCategories;

@@ -51,7 +51,7 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
protected $productsType;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductInterface", mappedBy="productFamily", orphanRemoval=true, cascade={"persist"}, fetch="EAGER")
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductInterface", mappedBy="productFamily", orphanRemoval=true, cascade={"persist"})
*/
protected $products;


+ 7
- 4
ShopBundle/Repository/ProductFamilyRepository.php Parādīt failu

@@ -9,7 +9,6 @@ use Lc\ShopBundle\Context\ReductionCatalogInterface;
/**
* @method ProductFamilyInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ProductFamilyInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ProductFamilyInterface[] findAll()
* @method ProductFamilyInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ProductFamilyRepository extends BaseRepository implements DefaultRepositoryInterface
@@ -27,12 +26,16 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
$query->innerJoin('e.products', 'pfp');
$query->addSelect('pfp') ;

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

return $query ;
}

public function findAll()
{
$query = $this->findByMerchantQuery() ;
$query = $this->joinRelations($query) ;
return $query->getQuery()->getResult() ;
}

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

+ 11
- 7
ShopBundle/Repository/ReductionCatalogRepository.php Parādīt failu

@@ -22,7 +22,6 @@ class ReductionCatalogRepository extends BaseRepository implements DefaultReposi

public function getReductionCatalogByProductFamily($productFamily, $user)
{

$query = $this->findByMerchantQuery();
$query->andWhere('e.status = 1');
$query->andWhere(':user MEMBER OF e.users OR e.users is empty');
@@ -36,19 +35,26 @@ class ReductionCatalogRepository extends BaseRepository implements DefaultReposi
$query->setParameter('productCategory', $productFamily->getProductCategories());
$query->setParameter('supplier', $productFamily->getSupplier());


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


}


public function getReductionCatalogByProductFamilyConditions($productFamilyIds, $user)
{

$query = $this->findByMerchantQuery();

$query->andWhere('e.status = 1');
$query->andWhere('e.permanent = 1 OR (e.dateStart <= :now AND e.dateEnd >= :now)');

$query->leftJoin('e.productFamilies', 'pfs') ;
$query->addSelect('pfs') ;

$query->leftJoin('e.productFamily', 'pf') ;
$query->addSelect('pf') ;

$query->leftJoin('e.productCategories', 'pc') ;
$query->addSelect('pc') ;

if($user){
$query->andWhere(':user MEMBER OF e.users OR e.users is empty');
$query->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty');
@@ -65,7 +71,5 @@ class ReductionCatalogRepository extends BaseRepository implements DefaultReposi
$query->setParameter(':now', new \DateTime());

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


}
}

Notiek ielāde…
Atcelt
Saglabāt