|
|
|
|
|
|
|
|
return ProductFamilyInterface::class; |
|
|
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){ |
|
|
public function getProductFamiliesByCategory($category){ |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
$query = $this->findByMerchantQuery() ; |
|
|
$query->leftJoin('e.productCategories', 'cat'); |
|
|
|
|
|
|
|
|
$query = $this->joinRelations($query) ; |
|
|
|
|
|
|
|
|
$query->andWhere(':category MEMBER OF e.productCategories'); |
|
|
$query->andWhere(':category MEMBER OF e.productCategories'); |
|
|
$query->andWhere('e.status = 1'); |
|
|
|
|
|
$query->setParameter('category', $category->getId()); |
|
|
$query->setParameter('category', $category->getId()); |
|
|
|
|
|
|
|
|
return $query->getQuery()->getResult() ; |
|
|
|
|
|
|
|
|
$query->andWhere('e.status = 1'); |
|
|
|
|
|
|
|
|
|
|
|
return $query->getQuery()->getResult() ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getProductFamiliesNovelties(){ |
|
|
public function getProductFamiliesNovelties(){ |
|
|
$query = $this->findByMerchantQuery(); |
|
|
$query = $this->findByMerchantQuery(); |
|
|
|
|
|
$query = $this->joinRelations($query) ; |
|
|
|
|
|
|
|
|
$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 = $this->joinRelations($query) ; |
|
|
|
|
|
|
|
|
$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 = $this->joinRelations($query) ; |
|
|
|
|
|
|
|
|
$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 = $this->joinRelations($query) ; |
|
|
|
|
|
|
|
|
$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.'%') ; |