/** * Validate currency of a price * * @param AttributeInterface|MetricInterface|ProductValueInterface $object * @param Constraint $constraint */ public function validate($object, Constraint $constraint) { if ($object instanceof ProductPriceInterface) { if (!in_array($object->getCurrency(), $this->getCurrencyCodes())) { $this->context->addViolationAt('currency', $constraint->unitMessage); } } }