/**
  * {@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);
 }
 /**
  * {@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);
 }
 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, $field, $direction)
 {
     $qb = $datasource->getQueryBuilder();
     $pqb = $this->repository->getProductQueryBuilder($qb);
     $pqb->addFieldSorter('family', $direction);
 }