public function getValuesFor($attribute,
$operator,
$queryConfig) { // Get the entity for the attribute, e.g. Shopware\Models\Article\Detail
$entity =
$this->
getDqlHelper()->
getEntityForAttribute($attribute);
// Get the prefixed column, e.g. detail.number
$column =
$this->
getDqlHelper()->
getColumnForAttribute($attribute);
// Alias for the entity, e.g. details
$alias =
$this->
getDqlHelper()->
getPrefixForEntity($entity);
// Get column name without prefix
list
($prefix,
$plainColumn) =
explode('.',
$column);
// Column type might be needed for additional formatting
$columnType =
$this->
getDqlHelper()->
getEntityManager()->
getClassMetadata($entity)->fieldMappings
[$plainColumn]['type'
];
// Query
$builder =
$this->
getDqlHelper()->
getEntityManager()->
createQueryBuilder() // Using distinct instead of groupBy is waaay faster - but will result in some pages having only one result
->
select("DISTINCT {
$column}"
) ->
from($entity,
$alias);