@@ 90-107 (lines=18) @@ | ||
87 | * |
|
88 | * @return array The prepared attributes |
|
89 | */ |
|
90 | protected function prepareAttributes() |
|
91 | { |
|
92 | ||
93 | // load the attribute ID |
|
94 | $attribute = $this->loadAttributeByAttributeCode($this->getValue(ColumnKeys::ATTRIBUTE_CODE)); |
|
95 | $attributeId = $attribute[MemberNames::ATTRIBUTE_ID]; |
|
96 | ||
97 | // load the sort order |
|
98 | $sortOrder = $this->getValue(ColumnKeys::POSITION); |
|
99 | ||
100 | // return the prepared attribute option |
|
101 | return $this->initializeEntity( |
|
102 | array( |
|
103 | MemberNames::ATTRIBUTE_ID => $attributeId, |
|
104 | MemberNames::SORT_ORDER => $sortOrder |
|
105 | ) |
|
106 | ); |
|
107 | } |
|
108 | ||
109 | /** |
|
110 | * Initialize the attribute with the passed attributes and returns an instance. |
@@ 86-106 (lines=21) @@ | ||
83 | * |
|
84 | * @return array The prepared attributes |
|
85 | */ |
|
86 | protected function prepareAttributes() |
|
87 | { |
|
88 | ||
89 | // load the option ID |
|
90 | $optionId = $this->getLastOptionId(); |
|
91 | ||
92 | // load the store ID |
|
93 | $storeId = $this->getRowStoreId(StoreViewCodes::ADMIN); |
|
94 | ||
95 | // load the attribute option value |
|
96 | $value = $this->getValue(ColumnKeys::VALUE); |
|
97 | ||
98 | // return the prepared attribute option |
|
99 | return $this->initializeEntity( |
|
100 | array( |
|
101 | MemberNames::OPTION_ID => $optionId, |
|
102 | MemberNames::STORE_ID => $storeId, |
|
103 | MemberNames::VALUE => $value |
|
104 | ) |
|
105 | ); |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * Initialize the attribute with the passed attributes and returns an instance. |
@@ 70-86 (lines=17) @@ | ||
67 | * |
|
68 | * @return array The processed row |
|
69 | */ |
|
70 | protected function process() |
|
71 | { |
|
72 | ||
73 | // query whether or not, we've found a new EAV attribute code => means we've found a new attribute |
|
74 | if ($this->hasBeenProcessed($attributeCode = $this->getValue(ColumnKeys::ATTRIBUTE_CODE))) { |
|
75 | return; |
|
76 | } |
|
77 | ||
78 | // try to load the EAV attribute with the code found in the CSV file |
|
79 | $attribute = $this->loadAttributeByAttributeCode($attributeCode); |
|
80 | ||
81 | // delete the EAV attribute with the code found in the CSV file |
|
82 | $this->deleteAttribute(array(MemberNames::ATTRIBUTE_ID => $attribute[MemberNames::ATTRIBUTE_ID])); |
|
83 | ||
84 | // temporary persist the ID of the deleted attribute |
|
85 | $this->setLastAttributeId($attribute[MemberNames::ATTRIBUTE_ID]); |
|
86 | } |
|
87 | ||
88 | /** |
|
89 | * Return's the attribute bunch processor instance. |