/**
  * @param Attribute $attribute
  * @param AttributeTypeInterface $attributeType
  * @param int|null $localeId
  * @param mixed $value
  */
 protected function setDefaultValueByField(Attribute $attribute, AttributeTypeInterface $attributeType, $localeId, $value)
 {
     $field = $attributeType->getDataTypeField();
     $defaultValue = $attribute->getDefaultValueByLocaleId($localeId);
     if (!$defaultValue) {
         $defaultValue = new AttributeDefaultValue();
         if ($localeId) {
             $defaultValue->setLocale($this->databaseHelper->findLocale($localeId));
         }
         $attribute->addDefaultValue($defaultValue);
     }
     if ($value instanceof FallbackType) {
         $this->propertyAccessor->setValue($defaultValue, $field, null);
         $defaultValue->setFallback($value->getType());
     } else {
         $this->propertyAccessor->setValue($defaultValue, $field, $attributeType->denormalize($value));
         $defaultValue->setFallback(null);
     }
 }
 /**
  * @expectedException \LogicException
  * @expectedExceptionMessage Several attribute default values found by the same locale ID.
  */
 public function testGetDefaultValueByLocaleIdException()
 {
     $locale = $this->createLocale(1);
     $firstValue = new AttributeDefaultValue();
     $firstValue->setLocale($locale);
     $secondValue = new AttributeDefaultValue();
     $secondValue->setLocale($locale);
     $attribute = new Attribute();
     $attribute->resetDefaultValues([$firstValue, $secondValue]);
     $attribute->getDefaultValueByLocaleId(1);
 }