/**
* Gets a list of all line items that are part of the group definition.
* This will only return full groups. If a item is missing, then the whole group is invalid.
* In addition to this, a group can indeed occur multiple times.
* So the result may come from multiple complete groups.
*/
public function getMatchingItems(DiscountLineItem
$discount, Cart
$cart, SalesChannelContext
$context): DiscountPackageCollection
{ /** @var array $groups */
$groups =
$discount->
getPayloadValue('setGroups'
);
$groupDefinitions =
$this->
buildGroupDefinitionList($groups);
$resultGroups =
$this->groupBuilder->
findGroupPackages($groupDefinitions,
$cart,
$context);
$maximumSetCount =
$resultGroups->
getLowestCommonGroupCountDenominator($groupDefinitions);
if ($maximumSetCount <= 0
) { return new DiscountPackageCollection();
} /** @var string $groupId */
$groupId =
$discount->
getPayloadValue('groupId'
);