/** * Get the internal key that is used to index * a product value in a collection of values * * @param ProductValueInterface $value * * @return string */ public static function getKey(ProductValueInterface $value, $separator = '-') { $attribute = $value->getAttribute(); $key = $attribute->getCode(); if ($attribute->isLocalizable()) { $key .= $separator . $value->getLocale(); } if ($attribute->isScopable()) { $key .= $separator . $value->getScope(); } return $key; }
/** * Normalize the field name for values * * @param ProductValueInterface $value * * @return string */ protected function getFieldValue($value) { $suffix = ''; if ($value->getAttribute()->isLocalizable()) { $suffix = sprintf('-%s', $value->getLocale()); } if ($value->getAttribute()->isScopable()) { $suffix .= sprintf('-%s', $value->getScope()); } return $value->getAttribute()->getCode() . $suffix; }