/** * {@inheritdoc} */ public function copyValue(array $products, $fromField, $toField, $fromLocale = null, $toLocale = null, $fromScope = null, $toScope = null) { $fromAttribute = $this->getAttribute($fromField); $toAttribute = $this->getAttribute($toField); $copier = $this->copierRegistry->get($fromAttribute, $toAttribute); $copier->copyValue($products, $fromAttribute, $toAttribute, $fromLocale, $toLocale, $fromScope, $toScope); return $this; }
/** * {@inheritdoc} */ public function copyData(ProductInterface $fromProduct, ProductInterface $toProduct, $fromField, $toField, array $options = []) { $fromAttribute = $this->getAttribute($fromField); $toAttribute = $this->getAttribute($toField); if (null !== $fromAttribute && null !== $toAttribute) { $copier = $this->copierRegistry->getAttributeCopier($fromAttribute, $toAttribute); } else { $copier = $this->copierRegistry->getFieldCopier($fromField, $toField); } if (null === $copier) { throw new \LogicException(sprintf('No copier found for fields "%s" and "%s"', $fromField, $toField)); } if (null !== $fromAttribute && null !== $toAttribute) { $copier->copyAttributeData($fromProduct, $toProduct, $fromAttribute, $toAttribute, $options); } else { $copier->copyFieldData($fromProduct, $toProduct, $fromField, $toField, $options); } return $this; }