コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, $field, $direction)
 {
     $attribute = $this->attributeRepository->findOneByCode($field);
     $qb = $datasource->getQueryBuilder();
     $pqb = $this->productRepository->getProductQueryBuilder($qb);
     $pqb->addAttributeSorter($attribute, $direction);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, $field, $direction)
 {
     $qb = $datasource->getQueryBuilder();
     $groupId = $this->requestParams->get('currentGroup', null);
     if (!$groupId) {
         throw new \LogicException('The current product group must be configured');
     }
     $field = 'in_group_' . $groupId;
     $pqb = $this->repository->getProductQueryBuilder($qb);
     $pqb->addFieldSorter($field, $direction);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, $field, $direction)
 {
     $qb = $datasource->getQueryBuilder();
     $pqb = $this->repository->getProductQueryBuilder($qb);
     $pqb->addFieldSorter('family', $direction);
 }