1 | <?php |
||
38 | class ProductMediaProcessor implements ProductMediaProcessorInterface |
||
39 | { |
||
40 | |||
41 | /** |
||
42 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
43 | * |
||
44 | * @var \TechDivision\Import\Connection\ConnectionInterface |
||
45 | */ |
||
46 | protected $connection; |
||
47 | |||
48 | /** |
||
49 | * The repository to load product media galleries. |
||
50 | * |
||
51 | * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepositoryInterface |
||
52 | */ |
||
53 | protected $productMediaGalleryRepository; |
||
54 | |||
55 | /** |
||
56 | * The repository to load product media gallery to entities. |
||
57 | * |
||
58 | * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepositoryInterface |
||
59 | */ |
||
60 | protected $productMediaGalleryValueToEntityRepository; |
||
61 | |||
62 | /** |
||
63 | * The repository to load product media gallery values. |
||
64 | * |
||
65 | * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepositoryInterface |
||
66 | */ |
||
67 | protected $productMediaGalleryValueRepository; |
||
68 | |||
69 | /** |
||
70 | * The action with the product media gallery CRUD methods. |
||
71 | * |
||
72 | * @var \TechDivision\Import\Actions\ActionInterface |
||
73 | */ |
||
74 | protected $productMediaGalleryAction; |
||
75 | |||
76 | /** |
||
77 | * The action with the product media gallery value CRUD methods. |
||
78 | * |
||
79 | * @var \TechDivision\Import\Actions\ActionInterface |
||
80 | */ |
||
81 | protected $productMediaGalleryValueAction; |
||
82 | |||
83 | /** |
||
84 | * The action with the product media gallery value to entity CRUD methods. |
||
85 | * |
||
86 | * @var \TechDivision\Import\Actions\ActionInterface |
||
87 | */ |
||
88 | protected $productMediaGalleryValueToEntityAction; |
||
89 | |||
90 | /** |
||
91 | * Initialize the processor with the necessary assembler and repository instances. |
||
92 | * |
||
93 | * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to use |
||
94 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepositoryInterface $productMediaGalleryRepository The product media gallery repository to use |
||
95 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepositoryInterface $productMediaGalleryValueRepository The product media gallery value repository to use |
||
96 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepositoryInterface $productMediaGalleryValueToEntityRepository The product media gallery value to entity repository to use |
||
97 | * @param \TechDivision\Import\Actions\ActionInterface $productMediaGalleryAction The product media gallery action to use |
||
98 | * @param \TechDivision\Import\Actions\ActionInterface $productMediaGalleryValueAction The product media gallery value action to use |
||
99 | * @param \TechDivision\Import\Actions\ActionInterface $productMediaGalleryValueToEntityAction The product media gallery value to entity action to use |
||
100 | */ |
||
101 | public function __construct( |
||
118 | |||
119 | /** |
||
120 | * Set's the passed connection. |
||
121 | * |
||
122 | * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set |
||
123 | * |
||
124 | * @return void |
||
125 | */ |
||
126 | public function setConnection(ConnectionInterface $connection) |
||
130 | |||
131 | /** |
||
132 | * Return's the connection. |
||
133 | * |
||
134 | * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance |
||
135 | */ |
||
136 | public function getConnection() |
||
140 | |||
141 | /** |
||
142 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
143 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
144 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
145 | * to autocommit mode. |
||
146 | * |
||
147 | * @return boolean Returns TRUE on success or FALSE on failure |
||
148 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
149 | */ |
||
150 | public function beginTransaction() |
||
154 | |||
155 | /** |
||
156 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
157 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
158 | * |
||
159 | * @return boolean Returns TRUE on success or FALSE on failure |
||
160 | * @link http://php.net/manual/en/pdo.commit.php |
||
161 | */ |
||
162 | public function commit() |
||
166 | |||
167 | /** |
||
168 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
169 | * |
||
170 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
171 | * rolled back the transaction. |
||
172 | * |
||
173 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
174 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
175 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
176 | * |
||
177 | * @return boolean Returns TRUE on success or FALSE on failure |
||
178 | * @link http://php.net/manual/en/pdo.rollback.php |
||
179 | */ |
||
180 | public function rollBack() |
||
184 | |||
185 | /** |
||
186 | * Set's the repository to load product media gallery data. |
||
187 | * |
||
188 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepositoryInterface $productMediaGalleryRepository The repository instance |
||
189 | * |
||
190 | * @return void |
||
191 | */ |
||
192 | public function setProductMediaGalleryRepository(ProductMediaGalleryRepositoryInterface $productMediaGalleryRepository) |
||
196 | |||
197 | /** |
||
198 | * Return's the repository to load product media gallery data. |
||
199 | * |
||
200 | * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepositoryInterface The repository instance |
||
201 | */ |
||
202 | public function getProductMediaGalleryRepository() |
||
206 | |||
207 | /** |
||
208 | * Set's the repository to load product media gallery value to entity data. |
||
209 | * |
||
210 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepositoryInterface $productMediaGalleryValueToEntityRepository The repository instance |
||
211 | * |
||
212 | * @return void |
||
213 | */ |
||
214 | public function setProductMediaGalleryValueToEntityRepository(ProductMediaGalleryValueToEntityRepositoryInterface $productMediaGalleryValueToEntityRepository) |
||
218 | |||
219 | /** |
||
220 | * Return's the repository to load product media gallery value to entity data. |
||
221 | * |
||
222 | * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepositoryInterface The repository instance |
||
223 | */ |
||
224 | public function getProductMediaGalleryValueToEntityRepository() |
||
228 | |||
229 | /** |
||
230 | * Set's the repository to load product media gallery value data. |
||
231 | * |
||
232 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepositoryInterface $productMediaGalleryValueRepository The repository instance |
||
233 | * |
||
234 | * @return void |
||
235 | */ |
||
236 | public function setProductMediaGalleryValueRepository(ProductMediaGalleryValueRepositoryInterface $productMediaGalleryValueRepository) |
||
240 | |||
241 | /** |
||
242 | * Return's the repository to load product media gallery value data. |
||
243 | * |
||
244 | * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepositoryInterface The repository instance |
||
245 | */ |
||
246 | public function getProductMediaGalleryValueRepository() |
||
250 | |||
251 | /** |
||
252 | * Set's the action with the product media gallery CRUD methods. |
||
253 | * |
||
254 | * @param \TechDivision\Import\Actions\ActionInterface $productMediaGalleryAction The action with the product media gallery CRUD methods |
||
255 | * |
||
256 | * @return void |
||
257 | */ |
||
258 | public function setProductMediaGalleryAction(ActionInterface $productMediaGalleryAction) |
||
262 | |||
263 | /** |
||
264 | * Return's the action with the product media gallery CRUD methods. |
||
265 | * |
||
266 | * @return \TechDivision\Import\Actions\ActionInterface The action with the product media gallery CRUD methods |
||
267 | */ |
||
268 | public function getProductMediaGalleryAction() |
||
272 | |||
273 | /** |
||
274 | * Set's the action with the product media gallery valueCRUD methods. |
||
275 | * |
||
276 | * @param \TechDivision\Import\Actions\ActionInterface $productMediaGalleryValueAction The action with the product media gallery value CRUD methods |
||
277 | * |
||
278 | * @return void |
||
279 | */ |
||
280 | public function setProductMediaGalleryValueAction(ActionInterface $productMediaGalleryValueAction) |
||
284 | |||
285 | /** |
||
286 | * Return's the action with the product media gallery valueCRUD methods. |
||
287 | * |
||
288 | * @return \TechDivision\Import\Actions\ActionInterface The action with the product media gallery value CRUD methods |
||
289 | */ |
||
290 | public function getProductMediaGalleryValueAction() |
||
294 | |||
295 | /** |
||
296 | * Set's the action with the product media gallery value to entity CRUD methods. |
||
297 | * |
||
298 | * @param \TechDivision\Import\Actions\ActionInterface $productMediaGalleryValueToEntityAction The action with the product media gallery value to entity CRUD methods |
||
299 | * |
||
300 | * @return void |
||
301 | */ |
||
302 | public function setProductMediaGalleryValueToEntityAction(ActionInterface $productMediaGalleryValueToEntityAction) |
||
306 | |||
307 | /** |
||
308 | * Return's the action with the product media gallery value to entity CRUD methods. |
||
309 | * |
||
310 | * @return \TechDivision\Import\Actions\ActionInterface $productMediaGalleryAction The action with the product media gallery value to entity CRUD methods |
||
311 | */ |
||
312 | public function getProductMediaGalleryValueToEntityAction() |
||
316 | |||
317 | /** |
||
318 | * Load's the product media gallery with the passed attribute ID + value. |
||
319 | * |
||
320 | * @param integer $attributeId The attribute ID of the product media gallery to load |
||
321 | * @param string $value The value of the product media gallery to load |
||
322 | * |
||
323 | * @return array The product media gallery |
||
324 | */ |
||
325 | public function loadProductMediaGallery($attributeId, $value) |
||
329 | |||
330 | /** |
||
331 | * Load's the product media gallery with the passed value/entity ID. |
||
332 | * |
||
333 | * @param integer $valueId The value ID of the product media gallery value to entity to load |
||
334 | * @param integer $entityId The entity ID of the product media gallery value to entity to load |
||
335 | * |
||
336 | * @return array The product media gallery |
||
337 | */ |
||
338 | public function loadProductMediaGalleryValueToEntity($valueId, $entityId) |
||
342 | |||
343 | /** |
||
344 | * Load's the product media gallery value with the passed value/store/parent ID. |
||
345 | * |
||
346 | * @param integer $valueId The value ID of the product media gallery value to load |
||
347 | * @param string $storeId The store ID of the product media gallery value to load |
||
348 | * @param string $entityId The entity ID of the parent product of the product media gallery value to load |
||
349 | * |
||
350 | * @return array The product media gallery value |
||
351 | */ |
||
352 | public function loadProductMediaGalleryValue($valueId, $storeId, $entityId) |
||
356 | |||
357 | /** |
||
358 | * Load's the product media gallery entities with the passed SKU. |
||
359 | * |
||
360 | * @param string $sku The SKU to load the media gallery entities for |
||
361 | * |
||
362 | * @return array The product media gallery entities |
||
363 | */ |
||
364 | public function getProductMediaGalleriesBySku($sku) |
||
368 | |||
369 | /** |
||
370 | * Persist's the passed product media gallery data and return's the ID. |
||
371 | * |
||
372 | * @param array $productMediaGallery The product media gallery data to persist |
||
373 | * @param string|null $name The name of the prepared statement that has to be executed |
||
374 | * |
||
375 | * @return string The ID of the persisted entity |
||
376 | */ |
||
377 | public function persistProductMediaGallery($productMediaGallery, $name = null) |
||
381 | |||
382 | /** |
||
383 | * Persist's the passed product media gallery value data. |
||
384 | * |
||
385 | * @param array $productMediaGalleryValue The product media gallery value data to persist |
||
386 | * @param string|null $name The name of the prepared statement that has to be executed |
||
387 | * |
||
388 | * @return void |
||
389 | */ |
||
390 | public function persistProductMediaGalleryValue($productMediaGalleryValue, $name = null) |
||
394 | |||
395 | /** |
||
396 | * Persist's the passed product media gallery value to entity data. |
||
397 | * |
||
398 | * @param array $productMediaGalleryValuetoEntity The product media gallery value to entity data to persist |
||
399 | * @param string|null $name The name of the prepared statement that has to be executed |
||
400 | * |
||
401 | * @return void |
||
402 | */ |
||
403 | public function persistProductMediaGalleryValueToEntity($productMediaGalleryValuetoEntity, $name = null) |
||
407 | |||
408 | /** |
||
409 | * Delete's the passed product media gallery data. |
||
410 | * |
||
411 | * @param array $row The product media gallery data to be deleted |
||
412 | * @param string|null $name The name of the prepared statement that has to be executed |
||
413 | * |
||
414 | * @return string The ID of the persisted entity |
||
415 | */ |
||
416 | public function deleteProductMediaGallery(array $row, $name = null) |
||
420 | } |
||
421 |