|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getProductFamiliesByCategory($category){ |
|
|
public function getProductFamiliesByCategory($category){ |
|
|
$expr = $this->_em->getExpressionBuilder(); |
|
|
|
|
|
|
|
|
|
|
|
$query = $this->findByMerchantQuery() ; |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
/* $query->select(array('e as product', 'reductionCatalog as reduction')); |
|
|
|
|
|
$query->from(ReductionCatalogInterface::class, 'reductionCatalog');*/ |
|
|
|
|
|
|
|
|
$query->leftJoin('e.productCategories', 'cat'); |
|
|
$query->andWhere(':category MEMBER OF e.productCategories'); |
|
|
$query->andWhere(':category MEMBER OF e.productCategories'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
/* /* $query->andWhere($query->expr()->orX( |
|
|
|
|
|
$query->expr()->eq('reductionCatalog', 'null'), |
|
|
|
|
|
$query->expr()->eq( 'reductionCatalog.status = 1 AND ( |
|
|
|
|
|
:user MEMBER OF reductionCatalog.users OR reductionCatalog.users is empty ) AND |
|
|
|
|
|
(:groupUser MEMBER OF reductionCatalog.groupUsers OR reductionCatalog.groupUsers is empty ) AND |
|
|
|
|
|
(e MEMBER OF reductionCatalog.productFamilies OR reductionCatalog.productFamilies is empty') |
|
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query |
|
|
|
|
|
->andWhere('reductionCatalog.status = 1') |
|
|
|
|
|
->andWhere(':user MEMBER OF reductionCatalog.users OR reductionCatalog.users is empty') |
|
|
|
|
|
->andWhere(':groupUser MEMBER OF reductionCatalog.groupUsers OR reductionCatalog.groupUsers is empty') |
|
|
|
|
|
->andWhere('e MEMBER OF reductionCatalog.productFamilies OR reductionCatalog.productFamilies is empty') |
|
|
|
|
|
//->andWhere(':category MEMBER OF reductionCatalog.productCategories OR reductionCatalog.productCategories is empty') |
|
|
|
|
|
//->andWhere('e.supplier MEMBER OF reductionCatalog.suppliers OR reductionCatalog.suppliers is empty') |
|
|
|
|
|
->setParameter('user', $user) |
|
|
|
|
|
->setParameter('groupUser', $user->getGroupUsers() |
|
|
|
|
|
);*/ |
|
|
|
|
|
|
|
|
|
|
|
$query->setParameter('category', $category->getId()); |
|
|
$query->setParameter('category', $category->getId()); |
|
|
|
|
|
|
|
|
return $query->getQuery()->getResult() ; |
|
|
return $query->getQuery()->getResult() ; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getProductFamiliesNovelties(){ |
|
|
public function getProductFamiliesNovelties(){ |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
|
|
|
|
|
|
$query = $this->findByMerchantQuery(); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere(':now <= e.propertyNoveltyExpirationDate') |
|
|
$query->andWhere(':now <= e.propertyNoveltyExpirationDate') |
|
|
->setParameter('now', new \DateTime()) ; |
|
|
->setParameter('now', new \DateTime()) ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getProductFamiliesLargeVolumes(){ |
|
|
public function getProductFamiliesLargeVolumes(){ |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
|
|
|
$query->leftJoin('e.productCategories', 'cat'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.propertyLargeVolume = 1'); |
|
|
$query->andWhere('e.propertyLargeVolume = 1'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getProductFamiliesOrganics(){ |
|
|
public function getProductFamiliesOrganics(){ |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
|
|
|
$query->leftJoin('e.productCategories', 'cat'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.propertyOrganicLabel IS NOT NULL'); |
|
|
$query->andWhere('e.propertyOrganicLabel IS NOT NULL'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function findByTerms($terms, $maxResults = false) |
|
|
public function findByTerms($terms, $maxResults = false) |
|
|
{ |
|
|
{ |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
|
|
|
$query->leftJoin('e.productCategories', 'cat'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
$query->andWhere('e.title LIKE :terms'); |
|
|
$query->andWhere('e.title LIKE :terms'); |
|
|
$query->setParameter(':terms', '%'.$terms.'%') ; |
|
|
$query->setParameter(':terms', '%'.$terms.'%') ; |