/** * {@inheritdoc} */ public function setValue(array $products, $field, $data, $locale = null, $scope = null) { $attribute = $this->getAttribute($field); $setter = $this->setterRegistry->get($attribute); $setter->setValue($products, $attribute, $data, $locale, $scope); return $this; }
/** * {@inheritdoc} */ public function setData(ProductInterface $product, $field, $data, array $options = []) { $attribute = $this->getAttribute($field); if (null !== $attribute) { $setter = $this->setterRegistry->getAttributeSetter($attribute); } else { $setter = $this->setterRegistry->getFieldSetter($field); } if (null === $setter) { throw new \LogicException(sprintf('No setter found for field "%s"', $field)); } if (null !== $attribute) { $setter->setAttributeData($product, $attribute, $data, $options); } else { $setter->setFieldData($product, $field, $data, $options); } return $this; }