{ $this->connection =
$connection;
$this->fieldHelper =
$fieldHelper;
} public function getQuery(array
$ids, ShopContextInterface
$context): QueryBuilder
{ $query =
$this->connection->
createQueryBuilder();
$query->
select($this->fieldHelper->
getCategoryFields()) ->
addSelect($this->fieldHelper->
getMediaFields()) ->
addSelect($this->fieldHelper->
getRelatedProductStreamFields()) ->
addSelect('GROUP_CONCAT(customerGroups.customergroupID) as __category_customer_groups'
) ;
$query->
from('s_categories', 'category'
) ->
leftJoin('category', 's_categories_attributes', 'categoryAttribute', 'categoryAttribute.categoryID = category.id'
) ->
leftJoin('category', 's_categories_avoid_customergroups', 'customerGroups', 'customerGroups.categoryID = category.id'
) ->
leftJoin('category', 's_media', 'media', 'media.id = category.mediaID'
) ->
leftJoin('media', 's_media_album_settings', 'mediaSettings', 'mediaSettings.albumID = media.albumID'
) ->
leftJoin('media', 's_media_attributes', 'mediaAttribute', 'mediaAttribute.mediaID = media.id'
) ->
leftJoin('category', 's_product_streams', 'stream', 'category.stream_id = stream.id'
) ->
leftJoin('stream', 's_product_streams_attributes', 'productStreamAttribute', 'stream.id = productStreamAttribute.streamId'
)