$this->
replaceIndividualCodes($promotionId,
$promotion->
getIndividualCodePattern(),
$amount,
$context);
return;
} $newCodes =
$this->
generateIndividualCodes( $promotion->
getIndividualCodePattern(),
$amount,
$promotion->
getIndividualCodes()->
getCodeArray() );
$codeEntries =
$this->
prepareCodeEntities($promotionId,
$newCodes);
$this->individualCodesRepository->
upsert($codeEntries,
$context);
} /**
* @throws PatternAlreadyInUseException
*/
public function replaceIndividualCodes(string
$promotionId, string
$pattern, int
$amount, Context
$context): void
{ if ($this->
isCodePatternAlreadyInUse($pattern,
$promotionId,
$context)) { throw PromotionException::
patternAlreadyInUse();
}