|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\ProductFamilyInterface;
- use Lc\ShopBundle\Context\ReductionCatalogInterface;
-
-
- class ProductFamilyRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return ProductFamilyInterface::class;
- }
-
-
- public function getProductFamiliesByCategory($category){
- $expr = $this->_em->getExpressionBuilder();
-
- $query = $this->findByMerchantQuery() ;
-
- $query->andWhere(':category MEMBER OF e.productCategories');
- $query->andWhere('e.status = 1');
-
-
-
- $query->setParameter('category', $category->getId());
-
- return $query->getQuery()->getResult() ;
-
- }
-
- public function getProductFamiliesNovelties(){
- $query = $this->findByMerchantQuery() ;
- $query->andWhere('e.status = 1');
- $query->andWhere(':now <= e.propertyNoveltyExpirationDate')
- ->setParameter('now', new \DateTime()) ;
-
- return $query->getQuery()->getResult() ;
- }
-
- public function getProductFamiliesLargeVolumes(){
- $query = $this->findByMerchantQuery() ;
- $query->andWhere('e.status = 1');
- $query->andWhere('e.propertyLargeVolume = 1');
-
- return $query->getQuery()->getResult() ;
- }
-
- public function getProductFamiliesOrganics(){
- $query = $this->findByMerchantQuery() ;
- $query->andWhere('e.status = 1');
- $query->andWhere('e.propertyOrganicLabel IS NOT NULL');
-
- return $query->getQuery()->getResult() ;
- }
-
- public function findByTerms($terms, $maxResults = false)
- {
- $query = $this->findByMerchantQuery() ;
- $query->andWhere('e.status = 1');
- $query->andWhere('e.title LIKE :terms');
- $query->setParameter(':terms', '%'.$terms.'%') ;
-
- if($maxResults) {
- $query->setMaxResults($maxResults) ;
- }
-
- return $query->getQuery()->getResult() ;
- }
-
-
- }
|