1 | <?php |
||
41 | class ProductBundleProcessor implements ProductBundleProcessorInterface |
||
42 | { |
||
43 | |||
44 | /** |
||
45 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
46 | * |
||
47 | * @var \PDO |
||
48 | */ |
||
49 | protected $connection; |
||
50 | |||
51 | /** |
||
52 | * The action for product bundle option CRUD methods. |
||
53 | * |
||
54 | * @var \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionAction |
||
55 | */ |
||
56 | protected $productBundleOptionAction; |
||
57 | |||
58 | /** |
||
59 | * The action for product bundle option value CRUD methods. |
||
60 | * |
||
61 | * @var \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionValueAction |
||
62 | */ |
||
63 | protected $productBundleOptionValueAction; |
||
64 | |||
65 | /** |
||
66 | * The action for product bundle selection CRUD methods. |
||
67 | * |
||
68 | * @var \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionAction |
||
69 | */ |
||
70 | protected $productBundleSelectionAction; |
||
71 | |||
72 | /** |
||
73 | * The action for product bundle selection price CRUD methods. |
||
74 | * |
||
75 | * @var \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionPriceAction |
||
76 | */ |
||
77 | protected $productBundleSelectionPriceAction; |
||
78 | |||
79 | /** |
||
80 | * The repository to load bundle option data. |
||
81 | * |
||
82 | * @var \TechDivision\Import\Product\Bundle\Respository\BundleOptionRepository |
||
83 | */ |
||
84 | protected $bundleOptionRespository; |
||
85 | |||
86 | /** |
||
87 | * The repository to load bundle option value data. |
||
88 | * |
||
89 | * @var \TechDivision\Import\Product\Bundle\Respository\BundleOptionValueRepository |
||
90 | */ |
||
91 | protected $bundleOptionValueRespository; |
||
92 | |||
93 | /** |
||
94 | * The repository to load bundle selection data. |
||
95 | * |
||
96 | * @var \TechDivision\Import\Product\Bundle\Respository\BundleSelectionRepository |
||
97 | */ |
||
98 | protected $bundleSelectionRespository; |
||
99 | |||
100 | /** |
||
101 | * The repository to load bundle selection price data. |
||
102 | * |
||
103 | * @var \TechDivision\Import\Product\Bundle\Respository\BundleSelectionPriceRepository |
||
104 | */ |
||
105 | protected $bundleSelectionPriceRespository; |
||
106 | |||
107 | /** |
||
108 | * Initialize the processor with the necessary assembler and repository instances. |
||
109 | * |
||
110 | * @param \PDO $connection The PDO connection to use |
||
111 | * @param \TechDivision\Import\Product\Bundle\Respository\BundleOptionRepository $bundleOptionRepository The bundle option repository to use |
||
112 | * @param \TechDivision\Import\Product\Bundle\Respository\BundleOptionValueRepository $bundleOptionValueRepository The bundle option value repository to use |
||
113 | * @param \TechDivision\Import\Product\Bundle\Respository\BundleSelectionRepository $bundleSelectionRepository The bundle selection repository to use |
||
114 | * @param \TechDivision\Import\Product\Bundle\Respository\BundleSelectionPriceRepository $bundleSelectionPriceRepository The bundle selection price repository to use |
||
115 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionAction $productBundleOptionAction The product bundle option action to use |
||
116 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionValueAction $productBundleOptionValueAction The product bundle option value action to use |
||
117 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionAction $productBundleSelectionAction The product bundle selection action to use |
||
118 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionPriceAction $productBundleSelectionPriceAction The product bundle selection price action to use |
||
119 | */ |
||
120 | public function __construct( |
||
141 | |||
142 | /** |
||
143 | * Set's the passed connection. |
||
144 | * |
||
145 | * @param \PDO $connection The connection to set |
||
146 | * |
||
147 | * @return void |
||
148 | */ |
||
149 | public function setConnection(\PDO $connection) |
||
153 | |||
154 | /** |
||
155 | * Return's the connection. |
||
156 | * |
||
157 | * @return \PDO The connection instance |
||
158 | */ |
||
159 | public function getConnection() |
||
163 | |||
164 | /** |
||
165 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
166 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
167 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
168 | * to autocommit mode. |
||
169 | * |
||
170 | * @return boolean Returns TRUE on success or FALSE on failure |
||
171 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
172 | */ |
||
173 | public function beginTransaction() |
||
177 | |||
178 | /** |
||
179 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
180 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
181 | * |
||
182 | * @return boolean Returns TRUE on success or FALSE on failure |
||
183 | * @link http://php.net/manual/en/pdo.commit.php |
||
184 | */ |
||
185 | public function commit() |
||
189 | |||
190 | /** |
||
191 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
192 | * |
||
193 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
194 | * rolled back the transaction. |
||
195 | * |
||
196 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
197 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
198 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
199 | * |
||
200 | * @return boolean Returns TRUE on success or FALSE on failure |
||
201 | * @link http://php.net/manual/en/pdo.rollback.php |
||
202 | */ |
||
203 | public function rollBack() |
||
207 | |||
208 | /** |
||
209 | * Set's the action with the product bundle option CRUD methods. |
||
210 | * |
||
211 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionAction $productBundleOptionAction The action with the product bundle option CRUD methods |
||
212 | * |
||
213 | * @return void |
||
214 | */ |
||
215 | public function setProductBundleOptionAction($productBundleOptionAction) |
||
219 | |||
220 | /** |
||
221 | * Return's the action with the product bundle option CRUD methods. |
||
222 | * |
||
223 | * @return \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionAction The action instance |
||
224 | */ |
||
225 | public function getProductBundleOptionAction() |
||
229 | |||
230 | /** |
||
231 | * Set's the action with the product bundle option value CRUD methods. |
||
232 | * |
||
233 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionValueAction $productBundleOptionValueAction The action with the product bundle option value CRUD methods |
||
234 | * |
||
235 | * @return void |
||
236 | */ |
||
237 | public function setProductBundleOptionValueAction($productBundleOptionValueAction) |
||
241 | |||
242 | /** |
||
243 | * Return's the action with the product bundle option value CRUD methods. |
||
244 | * |
||
245 | * @return \TechDivision\Import\Product\Bundle\Actions\ProductBundleOptionValueAction The action instance |
||
246 | */ |
||
247 | public function getProductBundleOptionValueAction() |
||
251 | |||
252 | /** |
||
253 | * Set's the action with the product bundle selection CRUD methods. |
||
254 | * |
||
255 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionAction $productBundleSelectionAction The action with the product bundle selection CRUD methods |
||
256 | * |
||
257 | * @return void |
||
258 | */ |
||
259 | public function setProductBundleSelectionAction($productBundleSelectionAction) |
||
263 | |||
264 | /** |
||
265 | * Return's the action with the product bundle selection CRUD methods. |
||
266 | * |
||
267 | * @return \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionAction The action instance |
||
268 | */ |
||
269 | public function getProductBundleSelectionAction() |
||
273 | |||
274 | /** |
||
275 | * Set's the action with the product bundle selection price CRUD methods. |
||
276 | * |
||
277 | * @param \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionPriceAction $productBundleSelectionPriceAction The action with the product bundle selection price CRUD methods |
||
278 | * |
||
279 | * @return void |
||
280 | */ |
||
281 | public function setProductBundleSelectionPriceAction($productBundleSelectionPriceAction) |
||
285 | |||
286 | /** |
||
287 | * Return's the action with the product bundle selection price CRUD methods. |
||
288 | * |
||
289 | * @return \TechDivision\Import\Product\Bundle\Actions\ProductBundleSelectionPriceAction The action instance |
||
290 | */ |
||
291 | public function getProductBundleSelectionPriceAction() |
||
295 | |||
296 | /** |
||
297 | * Set's the repository to load bundle option data. |
||
298 | * |
||
299 | * @param \TechDivision\Import\Product\Bundle\Repository\BundleOptionRespository $bundleOptionRespository The repository instance |
||
300 | * |
||
301 | * @return void |
||
302 | */ |
||
303 | public function setBundleOptionRepository($bundleOptionRespository) |
||
307 | |||
308 | /** |
||
309 | * Return's the respository to load bundle option data. |
||
310 | * |
||
311 | * @return \TechDivision\Import\Product\Bundle\Repository\BundleOptionRespository The repository instance |
||
312 | */ |
||
313 | public function getBundleOptionRepository() |
||
317 | |||
318 | /** |
||
319 | * Set's the repository to load bundle option value data. |
||
320 | * |
||
321 | * @param \TechDivision\Import\Product\Bundle\Repository\BundleOptionValueRespository $bundleOptionValueRespository The repository instance |
||
322 | * |
||
323 | * @return void |
||
324 | */ |
||
325 | public function setBundleOptionValueRepository($bundleOptionValueRespository) |
||
329 | |||
330 | /** |
||
331 | * Return's the respository to load bundle option value data. |
||
332 | * |
||
333 | * @return \TechDivision\Import\Product\Bundle\Repository\BundleOptionValueRespository The repository instance |
||
334 | */ |
||
335 | public function getBundleOptionValueRepository() |
||
339 | |||
340 | /** |
||
341 | * Set's the repository to load bundle selection data. |
||
342 | * |
||
343 | * @param \TechDivision\Import\Product\Bundle\Repository\BundleSelectionRespository $bundleSelectionRespository The repository instance |
||
344 | * |
||
345 | * @return void |
||
346 | */ |
||
347 | public function setBundleSelectionRepository($bundleSelectionRespository) |
||
351 | |||
352 | /** |
||
353 | * Return's the respository to load bundle selection data. |
||
354 | * |
||
355 | * @return \TechDivision\Import\Product\Bundle\Repository\BundleSelectionRespository The repository instance |
||
356 | */ |
||
357 | public function getBundleSelectionRepository() |
||
361 | |||
362 | /** |
||
363 | * Set's the repository to load bundle selection price data. |
||
364 | * |
||
365 | * @param \TechDivision\Import\Product\Bundle\Repository\BundleSelectionPriceRespository $bundleSelectionPriceRespository The repository instance |
||
366 | * |
||
367 | * @return void |
||
368 | */ |
||
369 | public function setBundleSelectionPriceRepository($bundleSelectionPriceRespository) |
||
373 | |||
374 | /** |
||
375 | * Return's the respository to load bundle selection price data. |
||
376 | * |
||
377 | * @return \TechDivision\Import\Product\Bundle\Repository\BundleSelectionPriceRespository The repository instance |
||
378 | */ |
||
379 | public function getBundleSelectionPriceRepository() |
||
383 | |||
384 | /** |
||
385 | * Load's the bundle option with the passed name, store + parent ID. |
||
386 | * |
||
387 | * @param string $title The title of the bundle option to be returned |
||
388 | * @param integer $storeId The store ID of the bundle option to be returned |
||
389 | * @param integer $parentId The entity of the product the bundle option is related with |
||
390 | * |
||
391 | * @return array The bundle option |
||
392 | */ |
||
393 | public function loadBundleOption($title, $storeId, $parentId) |
||
397 | |||
398 | /** |
||
399 | * Load's the bundle option value with the passed name, store + parent ID. |
||
400 | * |
||
401 | * @param string $title The title of the bundle option value to be returned |
||
402 | * @param integer $storeId The store ID of the bundle option value to be returned |
||
403 | * @param integer $parentId The entity of the product the bundle option value is related with |
||
404 | * |
||
405 | * @return array The bundle option |
||
406 | */ |
||
407 | public function loadBundleOptionValue($title, $storeId, $parentId) |
||
411 | |||
412 | /** |
||
413 | * Load's the bundle selection value with the passed option/product/parent product ID. |
||
414 | * |
||
415 | * @param integer $optionId The option ID of the bundle selection to be returned |
||
416 | * @param integer $productId The product ID of the bundle selection to be returned |
||
417 | * @param integer $parentProductId The parent product ID of the bundle selection to be returned |
||
418 | * |
||
419 | * @return array The bundle selection |
||
420 | */ |
||
421 | public function loadBundleSelection($optionId, $productId, $parentProductId) |
||
425 | |||
426 | /** |
||
427 | * Load's the bundle selection price with the passed selection/website ID. |
||
428 | * |
||
429 | * @param integer $selectionId The selection ID of the bundle selection price to be returned |
||
430 | * @param integer $websiteId The website ID of the bundle selection price to be returned |
||
431 | * |
||
432 | * @return array The bundle selection price |
||
433 | */ |
||
434 | public function loadBundleSelectionPrice($selectionId, $websiteId) |
||
438 | |||
439 | /** |
||
440 | * Persist's the passed product bundle option data and return's the ID. |
||
441 | * |
||
442 | * @param array $productBundleOption The product bundle option data to persist |
||
443 | * |
||
444 | * @return string The ID of the persisted entity |
||
445 | */ |
||
446 | public function persistProductBundleOption($productBundleOption) |
||
450 | |||
451 | /** |
||
452 | * Persist's the passed product bundle option value data. |
||
453 | * |
||
454 | * @param array $productBundleOptionValue The product bundle option value data to persist |
||
455 | * |
||
456 | * @return void |
||
457 | */ |
||
458 | public function persistProductBundleOptionValue($productBundleOptionValue) |
||
462 | |||
463 | /** |
||
464 | * Persist's the passed product bundle selection data and return's the ID. |
||
465 | * |
||
466 | * @param array $productBundleSelection The product bundle selection data to persist |
||
467 | * |
||
468 | * @return string The ID of the persisted entity |
||
469 | */ |
||
470 | public function persistProductBundleSelection($productBundleSelection) |
||
474 | |||
475 | /** |
||
476 | * Persist's the passed product bundle selection price data and return's the ID. |
||
477 | * |
||
478 | * @param array $productBundleSelectionPrice The product bundle selection price data to persist |
||
479 | * |
||
480 | * @return void |
||
481 | */ |
||
482 | public function persistProductBundleSelectionPrice($productBundleSelectionPrice) |
||
486 | } |
||
487 |
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: