/** @var string $association */
foreach ($this->requiredDalAssociations
as $association) { $globalCriteria->
addAssociation($association);
} /** @var PromotionCollection $foundPromotions */
$foundPromotions =
$this->gateway->
get($globalCriteria,
$context);
if (\
count($foundPromotions->
getElements()) <= 0
) { // no global code, so try with an individual code instead
$individualCriteria =
(new Criteria())->
addFilter(new PermittedIndividualCodePromotions([$currentCode],
$salesChannelId));
/** @var string $association */
foreach ($this->requiredDalAssociations
as $association) { $individualCriteria->
addAssociation($association);
} /** @var PromotionCollection $foundPromotions */
$foundPromotions =
$this->gateway->
get($individualCriteria,
$context);
} // if we finally have found promotions add them to our list for the current code