Exemplo n.º 1
0
 public function testUniqueSorting()
 {
     $criteria = new Criteria();
     $criteria->addSorting(new PriceSorting());
     $criteria->addSorting(new PriceSorting());
     $this->assertCount(1, $criteria->getSortings());
 }
Exemplo n.º 2
0
 /**
  * @param array $productStream
  * @param Criteria $criteria
  */
 private function prepareSelectionStream(array $productStream, Criteria $criteria)
 {
     $ordernumbers = $this->getOrdernumbers($productStream['id']);
     $criteria->addCondition(new OrdernumberCondition($ordernumbers));
     $sortings = $criteria->getSortings();
     if (empty($sortings)) {
         $this->assignSortings($productStream, $criteria);
     }
 }
Exemplo n.º 3
0
 /**
  * @param Criteria $criteria
  * @param QueryBuilder $query
  * @param ShopContextInterface $context
  * @throws \Exception
  */
 private function addSorting(Criteria $criteria, QueryBuilder $query, ShopContextInterface $context)
 {
     foreach ($criteria->getSortings() as $sorting) {
         $handler = $this->getSortingHandler($sorting);
         $handler->generateSorting($sorting, $query, $context);
     }
 }