1 | <?php |
||
40 | class ProductMediaProcessor implements ProductMediaProcessorInterface |
||
41 | { |
||
42 | |||
43 | /** |
||
44 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
45 | * |
||
46 | * @var \PDO |
||
47 | */ |
||
48 | protected $connection; |
||
49 | |||
50 | /** |
||
51 | * The repository to load product media galleries. |
||
52 | * |
||
53 | * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository |
||
54 | */ |
||
55 | protected $productMediaGalleryRepository; |
||
56 | |||
57 | /** |
||
58 | * The repository to load product media gallery to entities. |
||
59 | * |
||
60 | * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository |
||
61 | */ |
||
62 | protected $productMediaGalleryValueToEntityRepository; |
||
63 | |||
64 | /** |
||
65 | * The repository to load product media gallery values. |
||
66 | * |
||
67 | * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository |
||
68 | */ |
||
69 | protected $productMediaGalleryValueRepository; |
||
70 | |||
71 | /** |
||
72 | * The action with the product media gallery CRUD methods. |
||
73 | * |
||
74 | * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction |
||
75 | */ |
||
76 | protected $productMediaGalleryAction; |
||
77 | |||
78 | /** |
||
79 | * The action with the product media gallery value CRUD methods. |
||
80 | * |
||
81 | * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction |
||
82 | */ |
||
83 | protected $productMediaGalleryValueAction; |
||
84 | |||
85 | /** |
||
86 | * The action with the product media gallery value to entity CRUD methods. |
||
87 | * |
||
88 | * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction |
||
89 | */ |
||
90 | protected $productMediaGalleryValueToEntityAction; |
||
91 | |||
92 | /** |
||
93 | * The action with the product media gallery video CRUD methods. |
||
94 | * |
||
95 | * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryVideoAction |
||
96 | */ |
||
97 | protected $productMediaGalleryVideoAction; |
||
98 | |||
99 | /** |
||
100 | * Initialize the processor with the necessary assembler and repository instances. |
||
101 | * |
||
102 | * @param \PDO $connection The PDO connection to use |
||
103 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository $productMediaGalleryRepository The product media gallery repository to use |
||
104 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository $productMediaGalleryValueRepository The product media gallery value repository to use |
||
105 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The product media gallery value to entity repository to use |
||
106 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The product media gallery action to use |
||
107 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction $productMediaGalleryValueAction The product media gallery value action to use |
||
108 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction $productMediaGalleryValueToEntityAction The product media gallery value to entity action to use |
||
109 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryVideoAction $productMediaGalleryValueVideoAction The product media gallery value video action to use |
||
110 | */ |
||
111 | public function __construct( |
||
130 | |||
131 | /** |
||
132 | * Set's the passed connection. |
||
133 | * |
||
134 | * @param \PDO $connection The connection to set |
||
135 | * |
||
136 | * @return void |
||
137 | */ |
||
138 | public function setConnection(\PDO $connection) |
||
142 | |||
143 | /** |
||
144 | * Return's the connection. |
||
145 | * |
||
146 | * @return \PDO The connection instance |
||
147 | */ |
||
148 | public function getConnection() |
||
152 | |||
153 | /** |
||
154 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
155 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
156 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
157 | * to autocommit mode. |
||
158 | * |
||
159 | * @return boolean Returns TRUE on success or FALSE on failure |
||
160 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
161 | */ |
||
162 | public function beginTransaction() |
||
166 | |||
167 | /** |
||
168 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
169 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
170 | * |
||
171 | * @return boolean Returns TRUE on success or FALSE on failure |
||
172 | * @link http://php.net/manual/en/pdo.commit.php |
||
173 | */ |
||
174 | public function commit() |
||
178 | |||
179 | /** |
||
180 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
181 | * |
||
182 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
183 | * rolled back the transaction. |
||
184 | * |
||
185 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
186 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
187 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
188 | * |
||
189 | * @return boolean Returns TRUE on success or FALSE on failure |
||
190 | * @link http://php.net/manual/en/pdo.rollback.php |
||
191 | */ |
||
192 | public function rollBack() |
||
196 | |||
197 | /** |
||
198 | * Set's the repository to load product media gallery data. |
||
199 | * |
||
200 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository $productMediaGalleryRepository The repository instance |
||
201 | * |
||
202 | * @return void |
||
203 | */ |
||
204 | public function setProductMediaGalleryRepository($productMediaGalleryRepository) |
||
208 | |||
209 | /** |
||
210 | * Return's the repository to load product media gallery data. |
||
211 | * |
||
212 | * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository The repository instance |
||
213 | */ |
||
214 | public function getProductMediaGalleryRepository() |
||
218 | |||
219 | /** |
||
220 | * Set's the repository to load product media gallery value to entity data. |
||
221 | * |
||
222 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The repository instance |
||
223 | * |
||
224 | * @return void |
||
225 | */ |
||
226 | public function setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository) |
||
230 | |||
231 | /** |
||
232 | * Return's the repository to load product media gallery value to entity data. |
||
233 | * |
||
234 | * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository The repository instance |
||
235 | */ |
||
236 | public function getProductMediaGalleryValueToEntityRepository() |
||
240 | |||
241 | /** |
||
242 | * Set's the repository to load product media gallery value data. |
||
243 | * |
||
244 | * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository $productMediaGalleryValueRepository The repository instance |
||
245 | * |
||
246 | * @return void |
||
247 | */ |
||
248 | public function setProductMediaGalleryValueRepository($productMediaGalleryValueRepository) |
||
252 | |||
253 | /** |
||
254 | * Return's the repository to load product media gallery value data. |
||
255 | * |
||
256 | * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository The repository instance |
||
257 | */ |
||
258 | public function getProductMediaGalleryValueRepository() |
||
262 | |||
263 | /** |
||
264 | * Set's the action with the product media gallery CRUD methods. |
||
265 | * |
||
266 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The action with the product media gallery CRUD methods |
||
267 | * |
||
268 | * @return void |
||
269 | */ |
||
270 | public function setProductMediaGalleryAction($productMediaGalleryAction) |
||
274 | |||
275 | /** |
||
276 | * Return's the action with the product media gallery CRUD methods. |
||
277 | * |
||
278 | * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery CRUD methods |
||
279 | */ |
||
280 | public function getProductMediaGalleryAction() |
||
284 | |||
285 | /** |
||
286 | * Set's the action with the product media gallery valueCRUD methods. |
||
287 | * |
||
288 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueAction The action with the product media gallery value CRUD methods |
||
289 | * |
||
290 | * @return void |
||
291 | */ |
||
292 | public function setProductMediaGalleryValueAction($productMediaGalleryValueAction) |
||
296 | |||
297 | /** |
||
298 | * Return's the action with the product media gallery valueCRUD methods. |
||
299 | * |
||
300 | * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery value CRUD methods |
||
301 | */ |
||
302 | public function getProductMediaGalleryValueAction() |
||
306 | |||
307 | /** |
||
308 | * Set's the action with the product media gallery value to entity CRUD methods. |
||
309 | * |
||
310 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueToEntityAction The action with the product media gallery value to entity CRUD methods |
||
311 | * |
||
312 | * @return void |
||
313 | */ |
||
314 | public function setProductMediaGalleryValueToEntityAction($productMediaGalleryValueToEntityAction) |
||
318 | |||
319 | /** |
||
320 | * Return's the action with the product media gallery value to entity CRUD methods. |
||
321 | * |
||
322 | * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The action with the product media gallery value to entity CRUD methods |
||
323 | */ |
||
324 | public function getProductMediaGalleryValueToEntityAction() |
||
328 | |||
329 | /** |
||
330 | * Set's the action with the product media gallery value video CRUD methods. |
||
331 | * |
||
332 | * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueVideoAction The action with the product media gallery value video CRUD methods |
||
333 | * |
||
334 | * @return void |
||
335 | */ |
||
336 | public function setProductMediaGalleryValueVideoAction($productMediaGalleryValueVideoAction) |
||
340 | |||
341 | /** |
||
342 | * Return's the action with the product media gallery value video CRUD methods. |
||
343 | * |
||
344 | * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery value video CRUD methods |
||
345 | */ |
||
346 | public function getProductMediaGalleryValueVideoAction() |
||
350 | |||
351 | /** |
||
352 | * Load's the product media gallery with the passed attribute ID + value. |
||
353 | * |
||
354 | * @param integer $attributeId The attribute ID of the product media gallery to load |
||
355 | * @param string $value The value of the product media gallery to load |
||
356 | * |
||
357 | * @return array The product media gallery |
||
358 | */ |
||
359 | public function loadProductMediaGallery($attributeId, $value) |
||
363 | |||
364 | /** |
||
365 | * Load's the product media gallery with the passed value/entity ID. |
||
366 | * |
||
367 | * @param integer $valueId The value ID of the product media gallery value to entity to load |
||
368 | * @param integer $entityId The entity ID of the product media gallery value to entity to load |
||
369 | * |
||
370 | * @return array The product media gallery |
||
371 | */ |
||
372 | public function loadProductMediaGalleryValueToEntity($valueId, $entityId) |
||
376 | |||
377 | /** |
||
378 | * Load's the product media gallery value with the passed value/store/parent ID. |
||
379 | * |
||
380 | * @param integer $valueId The value ID of the product media gallery value to load |
||
381 | * @param string $storeId The store ID of the product media gallery value to load |
||
382 | * @param string $entityId The entity ID of the parent product of the product media gallery value to load |
||
383 | * |
||
384 | * @return array The product media gallery value |
||
385 | */ |
||
386 | public function loadProductMediaGalleryValue($valueId, $storeId, $entityId) |
||
390 | |||
391 | /** |
||
392 | * Persist's the passed product media gallery data and return's the ID. |
||
393 | * |
||
394 | * @param array $productMediaGallery The product media gallery data to persist |
||
395 | * @param string|null $name The name of the prepared statement that has to be executed |
||
396 | * |
||
397 | * @return string The ID of the persisted entity |
||
398 | */ |
||
399 | public function persistProductMediaGallery($productMediaGallery, $name = null) |
||
403 | |||
404 | /** |
||
405 | * Persist's the passed product media gallery value data. |
||
406 | * |
||
407 | * @param array $productMediaGalleryValue The product media gallery value data to persist |
||
408 | * @param string|null $name The name of the prepared statement that has to be executed |
||
409 | * |
||
410 | * @return void |
||
411 | */ |
||
412 | public function persistProductMediaGalleryValue($productMediaGalleryValue, $name = null) |
||
416 | |||
417 | /** |
||
418 | * Persist's the passed product media gallery value to entity data. |
||
419 | * |
||
420 | * @param array $productMediaGalleryValuetoEntity The product media gallery value to entity data to persist |
||
421 | * @param string|null $name The name of the prepared statement that has to be executed |
||
422 | * |
||
423 | * @return void |
||
424 | */ |
||
425 | public function persistProductMediaGalleryValueToEntity($productMediaGalleryValuetoEntity, $name = null) |
||
429 | |||
430 | /** |
||
431 | * Persist's the passed product media gallery value video data. |
||
432 | * |
||
433 | * @param array $productMediaGalleryValueVideo The product media gallery value video data to persist |
||
434 | * @param string|null $name The name of the prepared statement that has to be executed |
||
435 | * |
||
436 | * @return void |
||
437 | */ |
||
438 | public function persistProductMediaGalleryValueVideo($productMediaGalleryValueVideo, $name = null) |
||
442 | } |
||
443 |
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: