Parcourir la source

Merge branch 'develop'

master^2
Guillaume il y a 3 ans
Parent
révision
c31fba0e6d
1 fichiers modifiés avec 10 ajouts et 2 suppressions
  1. +10
    -2
      ShopBundle/Repository/ProductFamilyRepository.php

+ 10
- 2
ShopBundle/Repository/ProductFamilyRepository.php Voir le fichier

@@ -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() ;
}

Chargement…
Annuler
Enregistrer