|
|
@@ -44,6 +44,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor |
|
|
|
$query = $this->findByMerchantQuery() ; |
|
|
|
$query = $this->joinRelations($query) ; |
|
|
|
$query->andWhere('e.status = 1') ; |
|
|
|
$query->orderBy('RAND()'); |
|
|
|
return $query->getQuery()->getResult() ; |
|
|
|
} |
|
|
|
|
|
|
@@ -75,7 +76,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor |
|
|
|
$query->andWhere('e.status = 1'); |
|
|
|
$query->andWhere(':now <= e.propertyNoveltyExpirationDate') |
|
|
|
->setParameter('now', new \DateTime()) ; |
|
|
|
$query->orderBy('e.createdAt', 'DESC'); |
|
|
|
$query->orderBy('RAND()'); |
|
|
|
|
|
|
|
return $query->getQuery()->getResult() ; |
|
|
|
} |
|
|
@@ -122,13 +123,20 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor |
|
|
|
return $query->getQuery()->getResult() ; |
|
|
|
} |
|
|
|
|
|
|
|
public function getProductFamiliesBySection($section) |
|
|
|
public function getProductFamiliesBySection($section, $maxResults = false, $sortField = 'productCategories.position', $sortDirection = 'ASC') |
|
|
|
{ |
|
|
|
$query = $this->findByMerchantQuery() ; |
|
|
|
$query = $this->joinRelations($query) ; |
|
|
|
|
|
|
|
$query->andWhere(':section MEMBER OF e.sections') |
|
|
|
->setParameter('section', $section) ; |
|
|
|
$query->leftJoin('e.productCategories', 'productCategories'); |
|
|
|
if($sortField){ |
|
|
|
$query->orderBy($sortField,$sortDirection); |
|
|
|
} |
|
|
|
if($maxResults) { |
|
|
|
$query->setMaxResults($maxResults) ; |
|
|
|
} |
|
|
|
|
|
|
|
return $query->getQuery()->getResult() ; |
|
|
|
} |