1 | <?php |
||
39 | class ProductLinkProcessor implements ProductLinkProcessorInterface |
||
40 | { |
||
41 | |||
42 | /** |
||
43 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
44 | * |
||
45 | * @var \TechDivision\Import\Connection\ConnectionInterface |
||
46 | */ |
||
47 | protected $connection; |
||
48 | |||
49 | /** |
||
50 | * The repository to load product links. |
||
51 | * |
||
52 | * @var \TechDivision\Import\Product\Link\Repositories\ProductLinkRepositoryInterface |
||
53 | */ |
||
54 | protected $productLinkRepository; |
||
55 | |||
56 | /** |
||
57 | * The repository to load product link attribute integer attributes. |
||
58 | * |
||
59 | * @var \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeIntRepositoryInterface |
||
60 | */ |
||
61 | protected $productLinkAttributeIntRepository; |
||
62 | |||
63 | /** |
||
64 | * The repository to load product link attribute decimal attributes. |
||
65 | * |
||
66 | * @var \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeDecimalRepositoryInterface |
||
67 | */ |
||
68 | protected $productLinkAttributeDecimalRepository; |
||
69 | |||
70 | /** |
||
71 | * The repository to load product link attribute varchar attributes. |
||
72 | * |
||
73 | * @var \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeVarcharRepositoryInterface |
||
74 | */ |
||
75 | protected $productLinkAttributeVarcharRepository; |
||
76 | |||
77 | /** |
||
78 | * The action with the product link CRUD methods. |
||
79 | * |
||
80 | * @var \TechDivision\Import\Actions\ActionInterface |
||
81 | */ |
||
82 | protected $productLinkAction; |
||
83 | |||
84 | /** |
||
85 | * The action with the product link attribute integer CRUD methods. |
||
86 | * |
||
87 | * @var \TechDivision\Import\Actions\ActionInterface |
||
88 | */ |
||
89 | protected $productLinkAttributeIntAction; |
||
90 | |||
91 | /** |
||
92 | * The action with the product link attribute deciam CRUD methods. |
||
93 | * |
||
94 | * @var \TechDivision\Import\Actions\ActionInterface |
||
95 | */ |
||
96 | protected $productLinkAttributeDecimalAction; |
||
97 | |||
98 | /** |
||
99 | * The action with the product link attribute varchar CRUD methods. |
||
100 | * |
||
101 | * @var \TechDivision\Import\Actions\ActionInterface |
||
102 | */ |
||
103 | protected $productLinkAttributeVarcharAction; |
||
104 | |||
105 | /** |
||
106 | * Initialize the processor with the necessary assembler and repository instances. |
||
107 | * |
||
108 | * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to use |
||
109 | * @param \TechDivision\Import\Product\Link\Repositories\\ProductLinkRepositoryInterface $productLinkRepository The product link repository to use |
||
110 | * @param \TechDivision\Import\Product\Link\Repositories\\ProductLinkAttributeIntRepositoryInterface $productLinkAttributeIntRepository The product link attribute integer repository to use |
||
111 | * @param \TechDivision\Import\Product\Link\Repositories\\ProductLinkAttributeDecimalRepositoryInterface $productLinkAttributeDecimalRepository The product link attribute decimal repository to use |
||
112 | * @param \TechDivision\Import\Product\Link\Repositories\\ProductLinkAttributeVarcharRepositoryInterface $productLinkAttributeVarcharRepository The product link attribute varchar repository to use |
||
113 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAction The product link action to use |
||
114 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAttributeIntAction The product link attribute integer action to use |
||
115 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAttributeDecimalAction The product link attribute decimal action to use |
||
116 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAttributeVarcharAction The product link attribute varchar action to use |
||
117 | */ |
||
118 | public function __construct( |
||
139 | |||
140 | /** |
||
141 | * Set's the passed connection. |
||
142 | * |
||
143 | * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set |
||
144 | * |
||
145 | * @return void |
||
146 | */ |
||
147 | public function setConnection(ConnectionInterface $connection) |
||
151 | |||
152 | /** |
||
153 | * Return's the connection. |
||
154 | * |
||
155 | * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance |
||
156 | */ |
||
157 | public function getConnection() |
||
161 | |||
162 | /** |
||
163 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
164 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
165 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
166 | * to autocommit mode. |
||
167 | * |
||
168 | * @return boolean Returns TRUE on success or FALSE on failure |
||
169 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
170 | */ |
||
171 | public function beginTransaction() |
||
175 | |||
176 | /** |
||
177 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
178 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
179 | * |
||
180 | * @return boolean Returns TRUE on success or FALSE on failure |
||
181 | * @link http://php.net/manual/en/pdo.commit.php |
||
182 | */ |
||
183 | public function commit() |
||
187 | |||
188 | /** |
||
189 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
190 | * |
||
191 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
192 | * rolled back the transaction. |
||
193 | * |
||
194 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
195 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
196 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
197 | * |
||
198 | * @return boolean Returns TRUE on success or FALSE on failure |
||
199 | * @link http://php.net/manual/en/pdo.rollback.php |
||
200 | */ |
||
201 | public function rollBack() |
||
205 | |||
206 | /** |
||
207 | * Set's the repository to load product links. |
||
208 | * |
||
209 | * @param \TechDivision\Import\Product\Link\Repositories\ProductLinkRepositoryInterface $productLinkRepository The repository instance |
||
210 | * |
||
211 | * @return void |
||
212 | */ |
||
213 | public function setProductLinkRepository(ProductLinkRepositoryInterface $productLinkRepository) |
||
217 | |||
218 | /** |
||
219 | * Return's the repository to load product links. |
||
220 | * |
||
221 | * @return \TechDivision\Import\Product\Link\Repositories\ProductLinkRepositoryInterface The repository instance |
||
222 | */ |
||
223 | public function getProductLinkRepository() |
||
227 | |||
228 | /** |
||
229 | * Set's the repository to load product link attribute integer attributes. |
||
230 | * |
||
231 | * @param \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeIntRepositoryInterface $productLinkAttributeIntRepository The repository instance |
||
232 | * |
||
233 | * @return void |
||
234 | */ |
||
235 | public function setProductLinkAttributeIntRepository(ProductLinkAttributeIntRepositoryInterface $productLinkAttributeIntRepository) |
||
239 | |||
240 | /** |
||
241 | * Return's the repository to load product link attribute integer attributes. |
||
242 | * |
||
243 | * @return \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeIntRepositoryInterface The repository instance |
||
244 | */ |
||
245 | public function getProductLinkAttributeIntRepository() |
||
249 | |||
250 | /** |
||
251 | * Set's the repository to load product link attribute decimal attributes. |
||
252 | * |
||
253 | * @param \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeDecimalRepositoryInterface $productLinkAttributeDecimalRepository The repository instance |
||
254 | * |
||
255 | * @return void |
||
256 | */ |
||
257 | public function setProductLinkAttributeDecimalRepository(ProductLinkAttributeDecimalRepositoryInterface $productLinkAttributeDecimalRepository) |
||
261 | |||
262 | /** |
||
263 | * Return's the repository to load product link attribute decimal attributes. |
||
264 | * |
||
265 | * @return \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeDecimalRepositoryInterface The repository instance |
||
266 | */ |
||
267 | public function getProductLinkAttributeDecimalRepository() |
||
271 | |||
272 | /** |
||
273 | * Set's the repository to load product link attribute varchar attributes. |
||
274 | * |
||
275 | * @param \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeVarcharRepositoryInterface $productLinkAttributeVarcharRepository The repository instance |
||
276 | * |
||
277 | * @return void |
||
278 | */ |
||
279 | public function setProductLinkAttributeVarcharRepository(ProductLinkAttributeVarcharRepositoryInterface $productLinkAttributeVarcharRepository) |
||
283 | |||
284 | /** |
||
285 | * Return's the repository to load product link attribute varchar attributes. |
||
286 | * |
||
287 | * @return \TechDivision\Import\Product\Link\Repositories\ProductLinkAttributeVarcharRepositoryInterface The repository instance |
||
288 | */ |
||
289 | public function getProductLinkAttributeVarcharRepository() |
||
293 | |||
294 | /** |
||
295 | * Set's the action with the product link CRUD methods. |
||
296 | * |
||
297 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAction The action with the product link CRUD methods |
||
298 | * |
||
299 | * @return void |
||
300 | */ |
||
301 | public function setProductLinkAction(ActionInterface $productLinkAction) |
||
305 | |||
306 | /** |
||
307 | * Return's the action with the product link CRUD methods. |
||
308 | * |
||
309 | * @return \TechDivision\Import\Actions\ActionInterface The action with the product link CRUD methods |
||
310 | */ |
||
311 | public function getProductLinkAction() |
||
315 | |||
316 | /** |
||
317 | * Set's the action with the product link attribute integer CRUD methods. |
||
318 | * |
||
319 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAttributeIntAction The action with the product link attribute integer CRUD methods |
||
320 | * |
||
321 | * @return void |
||
322 | */ |
||
323 | public function setProductLinkAttributeIntAction(ActionInterface $productLinkAttributeIntAction) |
||
327 | |||
328 | /** |
||
329 | * Return's the action with the product link attribute integer CRUD methods. |
||
330 | * |
||
331 | * @return \TechDivision\Import\Actions\ActionInterface The action with the product link attribute integer CRUD methods |
||
332 | */ |
||
333 | public function getProductLinkAttributeIntAction() |
||
337 | |||
338 | /** |
||
339 | * Set's the action with the product link attribute decimal CRUD methods. |
||
340 | * |
||
341 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAttributeDecimalAction The action with the product link attribute decimal CRUD methods |
||
342 | * |
||
343 | * @return void |
||
344 | */ |
||
345 | public function setProductLinkAttributeDecimalAction(ActionInterface $productLinkAttributeDecimalAction) |
||
349 | |||
350 | /** |
||
351 | * Return's the action with the product link attribute decimal CRUD methods. |
||
352 | * |
||
353 | * @return \TechDivision\Import\Actions\ActionInterface The action with the product link attribute decimal CRUD methods |
||
354 | */ |
||
355 | public function getProductLinkAttributeDecimalAction() |
||
359 | |||
360 | /** |
||
361 | * Set's the action with the product link attribute varchar CRUD methods. |
||
362 | * |
||
363 | * @param \TechDivision\Import\Actions\ActionInterface $productLinkAttributeVarcharAction The action with the product link attribute varchar CRUD methods |
||
364 | * |
||
365 | * @return void |
||
366 | */ |
||
367 | public function setProductLinkAttributeVarcharAction(ActionInterface $productLinkAttributeVarcharAction) |
||
371 | |||
372 | /** |
||
373 | * Return's the action with the product link attribute varchar CRUD methods. |
||
374 | * |
||
375 | * @return \TechDivision\Import\Actions\ActionInterface The action with the product link attribute varchar CRUD methods |
||
376 | */ |
||
377 | public function getProductLinkAttributeVarcharAction() |
||
381 | |||
382 | /** |
||
383 | * Load's the link with the passed product/linked product/link type ID. |
||
384 | * |
||
385 | * @param integer $productId The product ID of the link to load |
||
386 | * @param integer $linkedProductId The linked product ID of the link to load |
||
387 | * @param integer $linkTypeId The link type ID of the product to load |
||
388 | * |
||
389 | * @return array The link |
||
390 | */ |
||
391 | public function loadProductLink($productId, $linkedProductId, $linkTypeId) |
||
395 | |||
396 | /** |
||
397 | * Return's the product link attribute integer value with the passed product link attribute/link ID. |
||
398 | * |
||
399 | * @param integer $productLinkAttributeId The product link attribute ID of the attributes |
||
400 | * @param integer $linkId The link ID of the attribute |
||
401 | * |
||
402 | * @return array The product link attribute integer value |
||
403 | */ |
||
404 | public function loadProductLinkAttributeInt($productLinkAttributeId, $linkId) |
||
408 | |||
409 | /** |
||
410 | * Return's the product link attribute decimal value with the passed product link attribute/link ID. |
||
411 | * |
||
412 | * @param integer $productLinkAttributeId The product link attribute ID of the attributes |
||
413 | * @param integer $linkId The link ID of the attribute |
||
414 | * |
||
415 | * @return array The product link attribute decimal value |
||
416 | */ |
||
417 | public function loadProductLinkAttributeDecimal($productLinkAttributeId, $linkId) |
||
421 | |||
422 | /** |
||
423 | * Return's the product link attribute varchar value with the passed product link attribute/link ID. |
||
424 | * |
||
425 | * @param integer $productLinkAttributeId The product link attribute ID of the attributes |
||
426 | * @param integer $linkId The link ID of the attribute |
||
427 | * |
||
428 | * @return array The product link attribute varchar value |
||
429 | */ |
||
430 | public function loadProductLinkAttributeVarchar($productLinkAttributeId, $linkId) |
||
434 | |||
435 | /** |
||
436 | * Persist's the passed product link data and return's the ID. |
||
437 | * |
||
438 | * @param array $productLink The product link data to persist |
||
439 | * |
||
440 | * @return string The ID of the persisted entity |
||
441 | */ |
||
442 | public function persistProductLink($productLink) |
||
446 | |||
447 | /** |
||
448 | * Delete's the passed product link data. |
||
449 | * |
||
450 | * @param array $row The product link to be deleted |
||
451 | * @param string|null $name The name of the prepared statement that has to be executed |
||
452 | * |
||
453 | * @return string The ID of the persisted entity |
||
454 | */ |
||
455 | public function deleteProductLink(array $row, $name = null) |
||
459 | |||
460 | /** |
||
461 | * Persist's the passed product link attribute integer data. |
||
462 | * |
||
463 | * @param array $productLinkAttributeInt The product link attribute integer data to persist |
||
464 | * |
||
465 | * @return void |
||
466 | */ |
||
467 | public function persistProductLinkAttributeInt($productLinkAttributeInt) |
||
471 | |||
472 | /** |
||
473 | * Persist's the passed product link attribute decimal data. |
||
474 | * |
||
475 | * @param array $productLinkAttributeDecimal The product link attribute decimal data to persist |
||
476 | * |
||
477 | * @return void |
||
478 | */ |
||
479 | public function persistProductLinkAttributeDecimal($productLinkAttributeDecimal) |
||
483 | |||
484 | /** |
||
485 | * Persist's the passed product link attribute varchar data. |
||
486 | * |
||
487 | * @param array $productLinkAttributeVarchar The product link attribute varchar data to persist |
||
488 | * |
||
489 | * @return void |
||
490 | */ |
||
491 | public function persistProductLinkAttributeVarchar($productLinkAttributeVarchar) |
||
495 | } |
||
496 |