| @@ 45-61 (lines=17) @@ | ||
| 42 | * |
|
| 43 | * @return array The initialized EAV attribute option value |
|
| 44 | */ |
|
| 45 | protected function initializeAttribute(array $attr) |
|
| 46 | { |
|
| 47 | ||
| 48 | // initialize the data to load the EAV attribute option swatch |
|
| 49 | $value = $this->getValue(ColumnKeys::SWATCH_VALUE); |
|
| 50 | $type = $this->getValue(ColumnKeys::SWATCH_TYPE); |
|
| 51 | $storeId = $this->getRowStoreId(StoreViewCodes::ADMIN); |
|
| 52 | $attributeCode = $this->getValue(ColumnKeys::ATTRIBUTE_CODE); |
|
| 53 | ||
| 54 | // try to load the EAV attribute option swatch |
|
| 55 | if ($attributeOptionSwatch = $this->loadAttributeOptionSwatchByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value, $type)) { |
|
| 56 | return $this->mergeEntity($attributeOptionSwatch, $attr); |
|
| 57 | } |
|
| 58 | ||
| 59 | // simply return the attributes |
|
| 60 | return $attr; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Load's and return's the EAV attribute option swatch with the passed code, store ID, value and type. |
|
| @@ 45-60 (lines=16) @@ | ||
| 42 | * |
|
| 43 | * @return array The initialized EAV attribute option |
|
| 44 | */ |
|
| 45 | protected function initializeAttribute(array $attr) |
|
| 46 | { |
|
| 47 | ||
| 48 | // initialize the data to load the EAV attribute option |
|
| 49 | $value = $this->getValue(ColumnKeys::VALUE); |
|
| 50 | $storeId = $this->getRowStoreId(StoreViewCodes::ADMIN); |
|
| 51 | $attributeCode = $this->getValue(ColumnKeys::ATTRIBUTE_CODE); |
|
| 52 | ||
| 53 | // try to load the EAV attribute option |
|
| 54 | if ($attributeOption = $this->loadAttributeOptionByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value)) { |
|
| 55 | return $this->mergeEntity($attributeOption, $attr); |
|
| 56 | } |
|
| 57 | ||
| 58 | // simply return the attributes |
|
| 59 | return $attr; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Load's and return's the EAV attribute option with the passed code, store ID and value. |
|
| @@ 71-92 (lines=22) @@ | ||
| 68 | * |
|
| 69 | * @return array The processed row |
|
| 70 | */ |
|
| 71 | protected function process() |
|
| 72 | { |
|
| 73 | ||
| 74 | // load the store value and the attribute code |
|
| 75 | $value = $this->getValue(ColumnKeys::ADMIN_STORE_VALUE); |
|
| 76 | $attributeCode = $this->getValue(ColumnKeys::ATTRIBUTE_CODE); |
|
| 77 | ||
| 78 | // query whether or not, we've found a new attribute code => means we've found a new EAV attribute |
|
| 79 | if ($this->hasBeenProcessed($attributeCode, $value)) { |
|
| 80 | return; |
|
| 81 | } |
|
| 82 | ||
| 83 | // load the ID of the admin store |
|
| 84 | $storeId = $this->getStoreId(StoreViewCodes::ADMIN); |
|
| 85 | ||
| 86 | // load the EAV attribute option with the passed value |
|
| 87 | $attributeOption = $this->getAttributeBunchProcessor() |
|
| 88 | ->loadAttributeOptionByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value); |
|
| 89 | ||
| 90 | // preserve the attribute ID for the passed EAV attribute option |
|
| 91 | $this->preLoadOptionId($attributeOption); |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Queries whether or not the option with the passed code/value has already been processed. |
|