Esempio n. 1
0
 /**
  * Get attribute value data
  *
  * @param array                  $data      Import row data
  * @param \XLite\Model\Attribute $attribute Attribute object
  *
  * @return array
  */
 protected function getAttributeValueData($data, $attribute)
 {
     $option = \XLite\Core\Database::getRepo('XLite\\Model\\AttributeOption')->findOneByNameAndAttribute($data['value'], $attribute);
     if (!$option) {
         $option = new \XLite\Model\AttributeOption();
         $option->setAttribute($attribute);
         $option->setName($data['value']);
         \XLite\Core\Database::getEM()->persist($option);
     }
     return array('attribute_option' => $option);
 }
Esempio n. 2
0
 /**
  * Create attribute option
  *
  * @param string $value Option name
  *
  * @return \XLite\Model\AttributeOption
  */
 protected function createAttributeOption($value)
 {
     $attributeOption = new \XLite\Model\AttributeOption();
     $attributeOption->setAttribute($this);
     $attributeOption->setName($value);
     \XLite\Core\Database::getEM()->persist($attributeOption);
     return $attributeOption;
 }