/** * Sets the options of the attribute * * @param string $class * @param AttributeInterface $attribute * @param array $optionsData */ protected function setOptions($class, AttributeInterface $attribute, array $optionsData) { $this->doctrineCache->setReference($attribute); $optionClass = $this->optionManager->getAttributeOptionClass(); foreach ($optionsData as $code => $optionData) { $optionData['attribute'] = $attribute->getCode(); if (!isset($optionData['code'])) { $optionData['code'] = $code; } $option = $this->transformNestedEntity($class, 'options', $optionClass, $optionData); $attribute->addOption($option); $this->doctrineCache->setReference($option); } }
/** * Persists an object * * @param object $object */ protected function persistObject($object) { if ($object instanceof \Pim\Bundle\CatalogBundle\Model\ProductInterface) { $this->mediaManager->handleProductMedias($object); } $this->objectManager->persist($object); $this->doctrineCache->setReference($object); }
/** * Persists an object * * @param object $object */ protected function persistObject($object) { //TODO: make this work without the media manager if ($object instanceof \Pim\Component\Catalog\Model\ProductInterface) { $this->mediaManager->handleProductMedias($object); } $this->objectManager->persist($object); $this->doctrineCache->setReference($object); }