1 | <?php |
||
36 | class VariantObserver extends AbstractProductImportObserver |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * The product relation's parent ID. |
||
41 | * |
||
42 | * @var integer |
||
43 | */ |
||
44 | protected $parentId; |
||
45 | |||
46 | /** |
||
47 | * The product relation's child ID. |
||
48 | * |
||
49 | * @var integer |
||
50 | */ |
||
51 | protected $childId; |
||
52 | |||
53 | /** |
||
54 | * Process the observer's business logic. |
||
55 | * |
||
56 | * @return array The processed row |
||
57 | */ |
||
58 | protected function process() |
||
97 | |||
98 | /** |
||
99 | * Prepare the product relation attributes that has to be persisted. |
||
100 | * |
||
101 | * @return array The prepared product relation attributes |
||
102 | */ |
||
103 | protected function prepareProductRelationAttributes() |
||
114 | |||
115 | /** |
||
116 | * Prepare the product super link attributes that has to be persisted. |
||
117 | * |
||
118 | * @return array The prepared product super link attributes |
||
119 | */ |
||
120 | protected function prepareProductSuperLinkAttributes() |
||
131 | |||
132 | /** |
||
133 | * Initialize the product relation with the passed attributes and returns an instance. |
||
134 | * |
||
135 | * @param array $attr The product relation attributes |
||
136 | * |
||
137 | * @return array|null The initialized product relation, or null if the relation already exsist |
||
138 | */ |
||
139 | protected function initializeProductRelation(array $attr) |
||
143 | |||
144 | /** |
||
145 | * Initialize the product super link with the passed attributes and returns an instance. |
||
146 | * |
||
147 | * @param array $attr The product super link attributes |
||
148 | * |
||
149 | * @return array|null The initialized product super link, or null if the super link already exsist |
||
150 | */ |
||
151 | protected function initializeProductSuperLink(array $attr) |
||
155 | |||
156 | /** |
||
157 | * Map's the passed SKU of the parent product to it's PK. |
||
158 | * |
||
159 | * @param string $parentSku The SKU of the parent product |
||
160 | * |
||
161 | * @return integer The primary key used to create relations |
||
162 | */ |
||
163 | protected function mapParentSku($parentSku) |
||
167 | |||
168 | /** |
||
169 | * Map's the passed SKU of the child product to it's PK. |
||
170 | * |
||
171 | * @param string $childSku The SKU of the child product |
||
172 | * |
||
173 | * @return integer The primary key used to create relations |
||
174 | */ |
||
175 | protected function mapChildSku($childSku) |
||
179 | |||
180 | /** |
||
181 | * Return the entity ID for the passed SKU. |
||
182 | * |
||
183 | * @param string $sku The SKU to return the entity ID for |
||
184 | * |
||
185 | * @return integer The mapped entity ID |
||
186 | * @throws \Exception Is thrown if the SKU is not mapped yet |
||
187 | */ |
||
188 | protected function mapSkuToEntityId($sku) |
||
192 | |||
193 | /** |
||
194 | * Persist's the passed product relation data and return's the ID. |
||
195 | * |
||
196 | * @param array $productRelation The product relation data to persist |
||
197 | * |
||
198 | * @return void |
||
199 | */ |
||
200 | protected function persistProductRelation($productRelation) |
||
204 | |||
205 | /** |
||
206 | * Persist's the passed product super link data and return's the ID. |
||
207 | * |
||
208 | * @param array $productSuperLink The product super link data to persist |
||
209 | * |
||
210 | * @return void |
||
211 | */ |
||
212 | protected function persistProductSuperLink($productSuperLink) |
||
216 | } |
||
217 |