/** * @param string $type * @param string $name * @param string|null $code */ private function createProductAttribute($type, $name, $code = null) { $productAttribute = $this->productAttributeFactory->createTyped($type); if (null === $code) { $code = StringInflector::nameToUppercaseCode($name); } $productAttribute->setCode($code); $productAttribute->setName($name); $this->productAttributeRepository->add($productAttribute); $this->sharedStorage->set('product_attribute', $productAttribute); }
/** * @param string $type * @param string $name * @param string|null $code */ private function createProductAttribute($type, $name, $code = null) { $productAttribute = $this->productAttributeFactory->createTyped($type); if (null === $code) { $code = str_replace(' ', '_', strtoupper($name)); } $productAttribute->setCode($code); $productAttribute->setName($name); $this->productAttributeRepository->add($productAttribute); $this->sharedStorage->set('product_attribute', $productAttribute); }
/** * @param ProductAttributeInterface $productAttribute */ private function saveProductAttribute(ProductAttributeInterface $productAttribute) { $this->productAttributeRepository->add($productAttribute); $this->sharedStorage->set('product_attribute', $productAttribute); }