1 | <?php |
||
36 | class LinkAttributePositionObserver extends AbstractProductImportObserver |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * The link attribute that has to be handled by this observer. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | const ATTRIBUTE_CODE = 'position'; |
||
45 | |||
46 | /** |
||
47 | * The product link attribute ID to persist the the position attribute for. |
||
48 | * |
||
49 | * @var integer |
||
50 | */ |
||
51 | protected $productLinktAttributeId; |
||
52 | |||
53 | /** |
||
54 | * Process the observer's business logic. |
||
55 | * |
||
56 | * @return array The processed row |
||
57 | */ |
||
58 | protected function process() |
||
90 | |||
91 | /** |
||
92 | * Prepare the attributes of the entity that has to be persisted. |
||
93 | * |
||
94 | * @return array The prepared attributes |
||
95 | */ |
||
96 | protected function prepareAttributes() |
||
117 | |||
118 | /** |
||
119 | * Temporary persist the product link attribute ID. |
||
120 | * |
||
121 | * @param integer $productLinkAttributeId The product link attribute ID |
||
122 | * |
||
123 | * @return void |
||
124 | */ |
||
125 | protected function setProductLinkAttributeId($productLinkAttributeId) |
||
129 | |||
130 | /** |
||
131 | * Return's the temporary persisted product link attribute ID. |
||
132 | * |
||
133 | * @return integer The product link attribute ID |
||
134 | */ |
||
135 | protected function getProductLinkAttributeId() |
||
139 | |||
140 | /** |
||
141 | * Return's the link attribute for the passed link type ID and attribute code. |
||
142 | * |
||
143 | * @param integer $linkTypeId The link type |
||
144 | * @param string $attributeCode The attribute code |
||
145 | * |
||
146 | * @return array The link attribute |
||
147 | */ |
||
148 | protected function getProductLinkAttribute($linkTypeId, $attributeCode) |
||
152 | |||
153 | /** |
||
154 | * Initialize the product link attribute with the passed attributes and returns an instance. |
||
155 | * |
||
156 | * @param array $attr The product link attribute |
||
157 | * |
||
158 | * @return array The initialized product link attribute |
||
159 | */ |
||
160 | protected function initializeProductLinkAttributeInt(array $attr) |
||
164 | |||
165 | /** |
||
166 | * Load the temporary persisted the last link ID. |
||
167 | * |
||
168 | * @return integer The last link ID |
||
169 | */ |
||
170 | protected function getLastLinkId() |
||
174 | |||
175 | /** |
||
176 | * Return the link type ID for the passed link type code. |
||
177 | * |
||
178 | * @param string $linkTypeCode The link type code to return the link type ID for |
||
179 | * |
||
180 | * @return integer The mapped link type ID |
||
181 | * @throws \Exception Is thrown if the link type code is not mapped yet |
||
182 | */ |
||
183 | protected function mapLinkTypeCodeToLinkTypeId($linkTypeCode) |
||
187 | |||
188 | /** |
||
189 | * Persist's the passed product link attribute int data and return's the ID. |
||
190 | * |
||
191 | * @param array $productLinkAttributeInt The product link attribute int data to persist |
||
192 | * |
||
193 | * @return string The ID of the persisted entity |
||
194 | */ |
||
195 | protected function persistProductLinkAttributeInt($productLinkAttributeInt) |
||
199 | } |
||
200 |