/**
  * @param Attribute $attribute
  * @param AttributeOption $option
  * @param int $localeId
  * @return AttributeDefaultValue
  */
 protected function generateOptionDefaultValue(Attribute $attribute, AttributeOption $option, $localeId)
 {
     $defaultValue = null;
     if ($option->getId()) {
         $defaultValue = $attribute->getDefaultValueByLocaleIdAndOptionId($localeId, $option->getId());
     }
     if (!$defaultValue) {
         $defaultValue = new AttributeDefaultValue();
         if ($localeId) {
             $defaultValue->setLocale($this->databaseHelper->findLocale($localeId));
         }
     }
     $defaultValue->setOption($option);
     return $defaultValue;
 }
 /**
  * @param Attribute $attribute
  * @param string $field
  * @param array $values
  */
 public function setPropertyValues(Attribute $attribute, $field, array $values)
 {
     foreach ($values as $websiteId => $value) {
         $attributeProperty = $attribute->getPropertyByFieldAndWebsiteId($field, $websiteId);
         if (!$attributeProperty) {
             $attributeProperty = new AttributeProperty();
             $attributeProperty->setField($field);
             if ($websiteId) {
                 $attributeProperty->setWebsite($this->databaseHelper->findWebsite($websiteId));
             }
             $attribute->addProperty($attributeProperty);
         }
         if ($value instanceof FallbackType) {
             $attributeProperty->setValue(null)->setFallback($value->getType());
         } else {
             $attributeProperty->setValue($value)->setFallback(null);
         }
     }
 }