/** * Validate that prices contain the currencies required by the channel * * @param ProductValueInterface $value * @param Constraint $constraint * * @return null */ protected function validatePrices(ProductValueInterface $value, Constraint $constraint) { $channel = $constraint->getChannel(); $expectedCurrencies = array_map(function ($currency) { return $currency->getCode(); }, $channel->getCurrencies()->toArray()); foreach ($expectedCurrencies as $currency) { foreach ($value->getData() as $price) { if ($price->getCurrency() === $currency) { if ($price->getData() === null) { $this->context->addViolation($constraint->messageComplete); } } } } }