{ $this->connection =
$connection;
$this->priceHydrator =
$priceHydrator;
$this->fieldHelper =
$fieldHelper;
} public function getPriceGroups(Group
$customerGroup, ShopContextInterface
$context) { $query =
$this->connection->
createQueryBuilder();
$query->
addSelect('priceGroupDiscount.groupID'
) ->
addSelect($this->fieldHelper->
getPriceGroupDiscountFields()) ->
addSelect($this->fieldHelper->
getPriceGroupFields());
$query->
from('s_core_pricegroups_discounts', 'priceGroupDiscount'
) ->
innerJoin('priceGroupDiscount', 's_core_pricegroups', 'priceGroup', 'priceGroup.id = priceGroupDiscount.groupID'
) ->
andWhere('priceGroupDiscount.customergroupID = :customerGroup'
) ->
groupBy('priceGroupDiscount.id'
) ->
orderBy('priceGroupDiscount.groupID'
) ->
addOrderBy('priceGroupDiscount.discountstart'
) ->
setParameter(':customerGroup',
$customerGroup->
getId());
$data =
$query->
execute()->
fetchAll(PDO::FETCH_GROUP
);