$promotionsList->
removeCode((string) $code);
} } $codesToFetch =
[];
// let's find out what promotions we
// really need to fetch from our database.
foreach ($allCodes as $code) { // check if promotion is already cached
if ($promotionsList->
hasCode($code)) { continue;
} // fetch that new code
$codesToFetch[] =
$code;
// add a new entry with null
// so if we cant fetch it, we do at least
// tell our cache that we have tried it
$promotionsList->
addCodePromotions($code,
[]);
}