CodeExplorer createFacets example
public function search(SearchBundle\Criteria
$criteria, ShopContextInterface
$context) { $query =
$this->queryBuilderFactory->
createProductQuery($criteria,
$context);
$products =
$this->
getProducts($query);
$total = \
count($products);
if ($criteria->
fetchCount()) { $total =
$this->
getTotalCount($query);
} $facets =
$this->
createFacets($criteria,
$context);
return new SearchBundle\
ProductNumberSearchResult($products,
(int) $total,
$facets);
} /**
* @return array
*/
private function getProducts(QueryBuilder
$query) { $data =
$query->
execute()->
fetchAll(PDO::FETCH_ASSOC
);
$products =
[];