1 | <?php |
||
43 | class ProductVariantProcessor implements ProductVariantProcessorInterface |
||
44 | { |
||
45 | |||
46 | /** |
||
47 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
48 | * |
||
49 | * @var \PDO |
||
50 | */ |
||
51 | protected $connection; |
||
52 | |||
53 | /** |
||
54 | * The repository to access product relations. |
||
55 | * |
||
56 | * @var \TechDivision\Import\Product\Repositories\ProductRelationRepository |
||
57 | */ |
||
58 | protected $productRelationRepository; |
||
59 | |||
60 | /** |
||
61 | * The repository to access product relations. |
||
62 | * |
||
63 | * @var \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository |
||
64 | */ |
||
65 | protected $productSuperLinkRepository; |
||
66 | |||
67 | /** |
||
68 | * The repository to access product super attributes. |
||
69 | * |
||
70 | * @var \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository |
||
71 | */ |
||
72 | protected $productSuperAttributeRepository; |
||
73 | |||
74 | /** |
||
75 | * The repository to access product super attribute labels. |
||
76 | * |
||
77 | * @var \TechDivision\Import\Product\Repositories\ProductSuperAttributeLabelRepository |
||
78 | */ |
||
79 | protected $productSuperAttributeLabelRepository; |
||
80 | |||
81 | /** |
||
82 | * The repository to access EAV attributes. |
||
83 | * |
||
84 | * @var \TechDivision\Import\Product\Repositories\EavAttributeRepository |
||
85 | */ |
||
86 | protected $eavAttributeRepository; |
||
87 | |||
88 | /** |
||
89 | * The repository to access EAV attribute option values. |
||
90 | * |
||
91 | * @var \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository |
||
92 | */ |
||
93 | protected $eavAttributeOptionValueRepository; |
||
94 | |||
95 | /** |
||
96 | * The action for product relation CRUD methods. |
||
97 | * |
||
98 | * @var \TechDivision\Import\Product\Variant\Actions\ProductRelationAction |
||
99 | */ |
||
100 | protected $productRelationAction; |
||
101 | |||
102 | /** |
||
103 | * The action for product super attribute CRUD methods. |
||
104 | * |
||
105 | * @var \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction |
||
106 | */ |
||
107 | protected $productSuperAttributeAction; |
||
108 | |||
109 | /** |
||
110 | * The action for product super attribute label CRUD methods. |
||
111 | * |
||
112 | * @var \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction |
||
113 | */ |
||
114 | protected $productSuperAttributeLabelAction; |
||
115 | |||
116 | /** |
||
117 | * The action for product super link CRUD methods. |
||
118 | * |
||
119 | * @var \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction |
||
120 | */ |
||
121 | protected $productSuperLinkAction; |
||
122 | |||
123 | /** |
||
124 | * Initialize the processor with the necessary assembler and repository instances. |
||
125 | * |
||
126 | * @param \PDO $connection The PDO connection to use |
||
127 | * @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository $eavAttributeOptionValueRepository The EAV attribute option value repository to use |
||
128 | * @param \TechDivision\Import\Product\Repositories\EavAttributeRepository $eavAttributeRepository The EAV attribute repository to use |
||
129 | * @param \TechDivision\Import\Product\Repositories\ProductRelationRepository $productRelationRepository The product relation repository to use |
||
130 | * @param \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository $productSuperLinkRepository The product super link repository to use |
||
131 | * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository $productSuperAttributeRepository The product super attribute repository to use |
||
132 | * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeLabelRepository $productSuperAttributeLabelRepository The product super attribute label repository to use |
||
133 | * @param \TechDivision\Import\Product\Variant\Actions\ProductRelationAction $productRelationAction The product relation action to use |
||
134 | * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction $productSuperLinkAction The product super link action to use |
||
135 | * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction $productSuperAttributeAction The product super attribute action to use |
||
136 | * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction $productSuperAttributeLabelAction The product super attribute label action to use |
||
137 | */ |
||
138 | public function __construct( |
||
163 | |||
164 | /** |
||
165 | * Set's the passed connection. |
||
166 | * |
||
167 | * @param \PDO $connection The connection to set |
||
168 | * |
||
169 | * @return void |
||
170 | */ |
||
171 | public function setConnection(\PDO $connection) |
||
175 | |||
176 | /** |
||
177 | * Return's the connection. |
||
178 | * |
||
179 | * @return \PDO The connection instance |
||
180 | */ |
||
181 | public function getConnection() |
||
185 | |||
186 | /** |
||
187 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
188 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
189 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
190 | * to autocommit mode. |
||
191 | * |
||
192 | * @return boolean Returns TRUE on success or FALSE on failure |
||
193 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
194 | */ |
||
195 | public function beginTransaction() |
||
199 | |||
200 | /** |
||
201 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
202 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
203 | * |
||
204 | * @return boolean Returns TRUE on success or FALSE on failure |
||
205 | * @link http://php.net/manual/en/pdo.commit.php |
||
206 | */ |
||
207 | public function commit() |
||
211 | |||
212 | /** |
||
213 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
214 | * |
||
215 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
216 | * rolled back the transaction. |
||
217 | * |
||
218 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
219 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
220 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
221 | * |
||
222 | * @return boolean Returns TRUE on success or FALSE on failure |
||
223 | * @link http://php.net/manual/en/pdo.rollback.php |
||
224 | */ |
||
225 | public function rollBack() |
||
229 | |||
230 | /** |
||
231 | * Set's the repository to access EAV attributes. |
||
232 | * |
||
233 | * @param \TechDivision\Import\Product\Repositories\EavAttributeRepository $eavAttributeRepository The repository to access EAV attributes |
||
234 | * |
||
235 | * @return void |
||
236 | */ |
||
237 | public function setEavAttributeRepository($eavAttributeRepository) |
||
241 | |||
242 | /** |
||
243 | * Return's the repository to access EAV attributes. |
||
244 | * |
||
245 | * @return \TechDivision\Import\Product\Repositories\EavAttributeRepository The repository instance |
||
246 | */ |
||
247 | public function getEavAttributeRepository() |
||
251 | |||
252 | /** |
||
253 | * Set's the repository to access product relations. |
||
254 | * |
||
255 | * @param \TechDivision\Import\Product\Repositories\ProductRelationRepository $productRelationRepository The repository instance |
||
256 | * |
||
257 | * @return void |
||
258 | */ |
||
259 | public function setProductRelationRepository($productRelationRepository) |
||
263 | |||
264 | /** |
||
265 | * Return's the repository to access product relations. |
||
266 | * |
||
267 | * @return \TechDivision\Import\Product\Repositories\ProductRelationRepository The repository instance |
||
268 | */ |
||
269 | public function getProductRelationRepository() |
||
273 | |||
274 | /** |
||
275 | * Set's the repository to access product super links. |
||
276 | * |
||
277 | * @param \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository $productSuperLinkRepository The repository instance |
||
278 | * |
||
279 | * @return void |
||
280 | */ |
||
281 | public function setProductSuperLinkRepository($productSuperLinkRepository) |
||
285 | |||
286 | /** |
||
287 | * Return's the repository to access product super links. |
||
288 | * |
||
289 | * @return \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository The repository instance |
||
290 | */ |
||
291 | public function getProductSuperLinkRepository() |
||
295 | |||
296 | /** |
||
297 | * Set's the repository to access product super attributes. |
||
298 | * |
||
299 | * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository $productSuperAttributeRepository The repository instance |
||
300 | * |
||
301 | * @return void |
||
302 | */ |
||
303 | public function setProductSuperAttributeRepository($productSuperAttributeRepository) |
||
307 | |||
308 | /** |
||
309 | * Return's the repository to access product super attributes. |
||
310 | * |
||
311 | * @return \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository The repository instance |
||
312 | */ |
||
313 | public function getProductSuperAttributeRepository() |
||
317 | |||
318 | /** |
||
319 | * Set's the repository to access product super attribute labels. |
||
320 | * |
||
321 | * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeLabelRepository $productSuperAttributeLabelRepository The repository instance |
||
322 | * |
||
323 | * @return void |
||
324 | */ |
||
325 | public function setProductSuperAttributeLabelRepository($productSuperAttributeLabelRepository) |
||
329 | |||
330 | /** |
||
331 | * Return's the repository to access product super attribute labels. |
||
332 | * |
||
333 | * @return \TechDivision\Import\Product\Repositories\ProductSuperAttributLabeleRepository The repository instance |
||
334 | */ |
||
335 | public function getProductSuperAttributeLabelRepository() |
||
339 | |||
340 | /** |
||
341 | * Set's the repository to access EAV attribute option values. |
||
342 | * |
||
343 | * @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository $eavAttributeOptionValueRepository The repository to access EAV attribute option values |
||
344 | * |
||
345 | * @return void |
||
346 | */ |
||
347 | public function setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository) |
||
351 | |||
352 | /** |
||
353 | * Return's the repository to access EAV attribute option values. |
||
354 | * |
||
355 | * @return \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository The repository instance |
||
356 | */ |
||
357 | public function getEavAttributeOptionValueRepository() |
||
361 | |||
362 | /** |
||
363 | * Set's the action with the product relation CRUD methods. |
||
364 | * |
||
365 | * @param \TechDivision\Import\Product\Variant\Actions\ProductRelationAction $productRelationAction The action with the product relation CRUD methods |
||
366 | * |
||
367 | * @return void |
||
368 | */ |
||
369 | public function setProductRelationAction($productRelationAction) |
||
373 | |||
374 | /** |
||
375 | * Return's the action with the product relation CRUD methods. |
||
376 | * |
||
377 | * @return \TechDivision\Import\Product\Variant\Actions\ProductRelationAction The action instance |
||
378 | */ |
||
379 | public function getProductRelationAction() |
||
383 | |||
384 | /** |
||
385 | * Set's the action with the product super attribute CRUD methods. |
||
386 | * |
||
387 | * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction $productSuperAttributeAction The action with the product super attribute CRUD methods |
||
388 | * |
||
389 | * @return void |
||
390 | */ |
||
391 | public function setProductSuperAttributeAction($productSuperAttributeAction) |
||
395 | |||
396 | /** |
||
397 | * Return's the action with the product super attribute CRUD methods. |
||
398 | * |
||
399 | * @return \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction The action instance |
||
400 | */ |
||
401 | public function getProductSuperAttributeAction() |
||
405 | |||
406 | /** |
||
407 | * Set's the action with the product super attribute label CRUD methods. |
||
408 | * |
||
409 | * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction $productSuperAttributeLabelAction The action with the product super attribute label CRUD methods |
||
410 | * |
||
411 | * @return void |
||
412 | */ |
||
413 | public function setProductSuperAttributeLabelAction($productSuperAttributeLabelAction) |
||
417 | |||
418 | /** |
||
419 | * Return's the action with the product super attribute label CRUD methods. |
||
420 | * |
||
421 | * @return \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction The action instance |
||
422 | */ |
||
423 | public function getProductSuperAttributeLabelAction() |
||
427 | |||
428 | /** |
||
429 | * Set's the action with the product super link CRUD methods. |
||
430 | * |
||
431 | * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction $productSuperLinkAction The action with the product super link CRUD methods |
||
432 | * |
||
433 | * @return void |
||
434 | */ |
||
435 | public function setProductSuperLinkAction($productSuperLinkAction) |
||
439 | |||
440 | /** |
||
441 | * Return's the action with the product super link CRUD methods. |
||
442 | * |
||
443 | * @return \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction The action instance |
||
444 | */ |
||
445 | public function getProductSuperLinkAction() |
||
449 | |||
450 | /** |
||
451 | * Return's the attribute option value with the passed value and store ID. |
||
452 | * |
||
453 | * @param mixed $value The option value |
||
454 | * @param integer $storeId The ID of the store |
||
455 | * |
||
456 | * @return array|boolean The attribute option value instance |
||
457 | */ |
||
458 | public function getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId) |
||
462 | |||
463 | /** |
||
464 | * Load's the product relation with the passed parent/child ID. |
||
465 | * |
||
466 | * @param integer $parentId The entity ID of the product relation's parent product |
||
467 | * @param integer $childId The entity ID of the product relation's child product |
||
468 | * |
||
469 | * @return array The product relation |
||
470 | */ |
||
471 | public function loadProductRelation($parentId, $childId) |
||
475 | |||
476 | /** |
||
477 | * Load's the product super link with the passed product/parent ID. |
||
478 | * |
||
479 | * @param integer $productId The entity ID of the product super link's product |
||
480 | * @param integer $parentId The entity ID of the product super link's parent product |
||
481 | * |
||
482 | * @return array The product super link |
||
483 | */ |
||
484 | public function loadProductSuperLink($productId, $parentId) |
||
488 | |||
489 | /** |
||
490 | * Load's the product super attribute with the passed product/attribute ID. |
||
491 | * |
||
492 | * @param integer $productId The entity ID of the product super attribute's product |
||
493 | * @param integer $attributeId The attribute ID of the product super attributes attribute |
||
494 | * |
||
495 | * @return array The product super attribute |
||
496 | */ |
||
497 | public function loadProductSuperAttribute($productId, $attributeId) |
||
501 | |||
502 | /** |
||
503 | * Load's the product super attribute label with the passed product super attribute/store ID. |
||
504 | * |
||
505 | * @param integer $productSuperAttributeId The product super attribute ID of the product super attribute label |
||
506 | * @param integer $storeId The store ID of the product super attribute label |
||
507 | * |
||
508 | * @return array The product super attribute label |
||
509 | */ |
||
510 | public function loadProductSuperAttributeLabel($productSuperAttributeId, $storeId) |
||
514 | |||
515 | /** |
||
516 | * Persist's the passed product relation data and return's the ID. |
||
517 | * |
||
518 | * @param array $productRelation The product relation data to persist |
||
519 | * @param string|null $name The name of the prepared statement that has to be executed |
||
520 | * |
||
521 | * @return void |
||
522 | */ |
||
523 | public function persistProductRelation($productRelation, $name = null) |
||
527 | |||
528 | /** |
||
529 | * Persist's the passed product super link data and return's the ID. |
||
530 | * |
||
531 | * @param array $productSuperLink The product super link data to persist |
||
532 | * @param string|null $name The name of the prepared statement that has to be executed |
||
533 | * |
||
534 | * @return void |
||
535 | */ |
||
536 | public function persistProductSuperLink($productSuperLink, $name = null) |
||
540 | |||
541 | /** |
||
542 | * Persist's the passed product super attribute data and return's the ID. |
||
543 | * |
||
544 | * @param array $productSuperAttribute The product super attribute data to persist |
||
545 | * @param string|null $name The name of the prepared statement that has to be executed |
||
546 | * |
||
547 | * @return string The ID of the persisted product super attribute entity |
||
548 | */ |
||
549 | public function persistProductSuperAttribute($productSuperAttribute, $name = null) |
||
553 | |||
554 | /** |
||
555 | * Persist's the passed product super attribute label data and return's the ID. |
||
556 | * |
||
557 | * @param array $productSuperAttributeLabel The product super attribute label data to persist |
||
558 | * @param string|null $name The name of the prepared statement that has to be executed |
||
559 | * |
||
560 | * @return void |
||
561 | */ |
||
562 | public function persistProductSuperAttributeLabel($productSuperAttributeLabel, $name = null) |
||
566 | } |
||
567 |
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: