/** * 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->buildViolation($constraint->unitMessage)->atPath('currency')->addViolation(); } } }