/** * {@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); }
/** * Returns the Attribute * * @param string $code * * @return AbstractAttribute */ protected function getAttributeByCode($code) { return $this->attributeRepository->findOneByCode($code); }