1 | <?php |
||
37 | class VariantObserver extends AbstractProductImportObserver |
||
38 | { |
||
39 | |||
40 | /** |
||
41 | * The product relation's parent ID. |
||
42 | * |
||
43 | * @var integer |
||
44 | */ |
||
45 | protected $parentId; |
||
46 | |||
47 | /** |
||
48 | * The product relation's child ID. |
||
49 | * |
||
50 | * @var integer |
||
51 | */ |
||
52 | protected $childId; |
||
53 | |||
54 | /** |
||
55 | * The product variant processor instance. |
||
56 | * |
||
57 | * @var \TechDivision\Import\Product\Variant\Services\ProductVariantProcessorInterface |
||
58 | */ |
||
59 | protected $productVariantProcessor; |
||
60 | |||
61 | /** |
||
62 | * Initialize the observer with the passed product variant processor instance. |
||
63 | * |
||
64 | * @param \TechDivision\Import\Product\Variant\Services\ProductVariantProcessorInterface $productVariantProcessor The product variant processor instance |
||
65 | */ |
||
66 | public function __construct(ProductVariantProcessorInterface $productVariantProcessor) |
||
70 | |||
71 | /** |
||
72 | * Return's the product variant processor instance. |
||
73 | * |
||
74 | * @return \TechDivision\Import\Product\Variant\Services\ProductVariantProcessorInterface The product variant processor instance |
||
75 | */ |
||
76 | protected function getProductVariantProcessor() |
||
80 | |||
81 | /** |
||
82 | * Process the observer's business logic. |
||
83 | * |
||
84 | * @return array The processed row |
||
85 | */ |
||
86 | protected function process() |
||
142 | |||
143 | /** |
||
144 | * Prepare the product relation attributes that has to be persisted. |
||
145 | * |
||
146 | * @return array The prepared product relation attributes |
||
147 | */ |
||
148 | protected function prepareProductRelationAttributes() |
||
159 | |||
160 | /** |
||
161 | * Prepare the product super link attributes that has to be persisted. |
||
162 | * |
||
163 | * @return array The prepared product super link attributes |
||
164 | */ |
||
165 | protected function prepareProductSuperLinkAttributes() |
||
176 | |||
177 | /** |
||
178 | * Initialize the product relation with the passed attributes and returns an instance. |
||
179 | * |
||
180 | * @param array $attr The product relation attributes |
||
181 | * |
||
182 | * @return array|null The initialized product relation, or null if the relation already exsist |
||
183 | */ |
||
184 | protected function initializeProductRelation(array $attr) |
||
188 | |||
189 | /** |
||
190 | * Initialize the product super link with the passed attributes and returns an instance. |
||
191 | * |
||
192 | * @param array $attr The product super link attributes |
||
193 | * |
||
194 | * @return array|null The initialized product super link, or null if the super link already exsist |
||
195 | */ |
||
196 | protected function initializeProductSuperLink(array $attr) |
||
200 | |||
201 | /** |
||
202 | * Map's the passed SKU of the parent product to it's PK. |
||
203 | * |
||
204 | * @param string $parentSku The SKU of the parent product |
||
205 | * |
||
206 | * @return integer The primary key used to create relations |
||
207 | */ |
||
208 | protected function mapParentSku($parentSku) |
||
212 | |||
213 | /** |
||
214 | * Map's the passed SKU of the child product to it's PK. |
||
215 | * |
||
216 | * @param string $childSku The SKU of the child product |
||
217 | * |
||
218 | * @return integer The primary key used to create relations |
||
219 | */ |
||
220 | protected function mapChildSku($childSku) |
||
224 | |||
225 | /** |
||
226 | * Return the entity ID for the passed SKU. |
||
227 | * |
||
228 | * @param string $sku The SKU to return the entity ID for |
||
229 | * |
||
230 | * @return integer The mapped entity ID |
||
231 | * @throws \Exception Is thrown if the SKU is not mapped yet |
||
232 | */ |
||
233 | protected function mapSkuToEntityId($sku) |
||
237 | |||
238 | /** |
||
239 | * Persist's the passed product relation data and return's the ID. |
||
240 | * |
||
241 | * @param array $productRelation The product relation data to persist |
||
242 | * |
||
243 | * @return void |
||
244 | */ |
||
245 | protected function persistProductRelation($productRelation) |
||
249 | |||
250 | /** |
||
251 | * Persist's the passed product super link data and return's the ID. |
||
252 | * |
||
253 | * @param array $productSuperLink The product super link data to persist |
||
254 | * |
||
255 | * @return void |
||
256 | */ |
||
257 | protected function persistProductSuperLink($productSuperLink) |
||
261 | } |
||
262 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: