1 | <?php |
||
40 | class ProductUrlRewriteProcessor implements ProductUrlRewriteProcessorInterface |
||
41 | { |
||
42 | |||
43 | /** |
||
44 | * A PDO connection initialized with the values from the Doctrine EntityManager. |
||
45 | * |
||
46 | * @var \TechDivision\Import\Connection\ConnectionInterface |
||
47 | */ |
||
48 | protected $connection; |
||
49 | |||
50 | /** |
||
51 | * The action for URL rewrite CRUD methods. |
||
52 | * |
||
53 | * @var \TechDivision\Import\Actions\UrlRewriteAction |
||
54 | */ |
||
55 | protected $urlRewriteAction; |
||
56 | |||
57 | /** |
||
58 | * The action for URL rewrite product category CRUD methods. |
||
59 | * |
||
60 | * @var \TechDivision\Import\Product\Actions\UrlRewriteProductCategoryAction |
||
61 | */ |
||
62 | protected $urlRewriteProductCategoryAction; |
||
63 | |||
64 | /** |
||
65 | * The repository to load the products with. |
||
66 | * |
||
67 | * @var \TechDivision\Import\Product\Repositories\ProductRepository |
||
68 | */ |
||
69 | protected $productRepository; |
||
70 | |||
71 | /** |
||
72 | * The repository to load the URL rewrites with. |
||
73 | * |
||
74 | * @var \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteRepository |
||
75 | */ |
||
76 | protected $urlRewriteRepository; |
||
77 | |||
78 | /** |
||
79 | * The repository to load the URL rewrite product category relations with. |
||
80 | * |
||
81 | * @var \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteProductCategoryRepository |
||
82 | */ |
||
83 | protected $urlRewriteProductCategoryRepository; |
||
84 | |||
85 | /** |
||
86 | * Initialize the processor with the necessary assembler and repository instances. |
||
87 | * |
||
88 | * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to use |
||
89 | * @param \TechDivision\Import\Product\Repositories\ProductRepository $productRepository The product repository to use |
||
90 | * @param \TechDivision\Import\Product\Repositories\ProductVarcharRepository $productVarcharRepository The product varchar repository to use |
||
91 | * @param \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteRepository $urlRewriteRepository The URL rewrite repository to use |
||
92 | * @param \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteProductCategoryRepository $urlRewriteProductCategoryRepository The URL rewrite product category repository to use |
||
93 | * @param \TechDivision\Import\Actions\UrlRewriteAction $urlRewriteAction The URL rewrite action to use |
||
94 | * @param \TechDivision\Import\Product\Actions\UrlRewriteProductCategoryAction $urlRewriteProductCategoryAction The URL rewrite product category action to use |
||
95 | */ |
||
96 | public function __construct( |
||
113 | |||
114 | /** |
||
115 | * Set's the passed connection. |
||
116 | * |
||
117 | * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set |
||
118 | * |
||
119 | * @return void |
||
120 | */ |
||
121 | public function setConnection(ConnectionInterface $connection) |
||
125 | |||
126 | /** |
||
127 | * Return's the connection. |
||
128 | * |
||
129 | * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance |
||
130 | */ |
||
131 | public function getConnection() |
||
135 | |||
136 | /** |
||
137 | * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
||
138 | * object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
||
139 | * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
||
140 | * to autocommit mode. |
||
141 | * |
||
142 | * @return boolean Returns TRUE on success or FALSE on failure |
||
143 | * @link http://php.net/manual/en/pdo.begintransaction.php |
||
144 | */ |
||
145 | public function beginTransaction() |
||
149 | |||
150 | /** |
||
151 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
||
152 | * ProductProcessor::beginTransaction() starts a new transaction. |
||
153 | * |
||
154 | * @return boolean Returns TRUE on success or FALSE on failure |
||
155 | * @link http://php.net/manual/en/pdo.commit.php |
||
156 | */ |
||
157 | public function commit() |
||
161 | |||
162 | /** |
||
163 | * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
||
164 | * |
||
165 | * If the database was set to autocommit mode, this function will restore autocommit mode after it has |
||
166 | * rolled back the transaction. |
||
167 | * |
||
168 | * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
||
169 | * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
||
170 | * COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
||
171 | * |
||
172 | * @return boolean Returns TRUE on success or FALSE on failure |
||
173 | * @link http://php.net/manual/en/pdo.rollback.php |
||
174 | */ |
||
175 | public function rollBack() |
||
179 | |||
180 | /** |
||
181 | * Set's the action with the URL rewrite CRUD methods. |
||
182 | * |
||
183 | * @param \TechDivision\Import\Actions\UrlRewriteAction $urlRewriteAction The action with the URL rewrite CRUD methods |
||
184 | * |
||
185 | * @return void |
||
186 | */ |
||
187 | public function setUrlRewriteAction($urlRewriteAction) |
||
191 | |||
192 | /** |
||
193 | * Return's the action with the URL rewrite CRUD methods. |
||
194 | * |
||
195 | * @return \TechDivision\Import\Actions\UrlRewriteAction The action instance |
||
196 | */ |
||
197 | public function getUrlRewriteAction() |
||
201 | |||
202 | /** |
||
203 | * Set's the action with the URL rewrite product category CRUD methods. |
||
204 | * |
||
205 | * @param \TechDivision\Import\Product\Actions\UrlRewriteProductCategoryAction $urlRewriteProductCategoryAction The action with the URL rewrite CRUD methods |
||
206 | * |
||
207 | * @return void |
||
208 | */ |
||
209 | public function setUrlRewriteProductCategoryAction($urlRewriteProductCategoryAction) |
||
213 | |||
214 | /** |
||
215 | * Return's the action with the URL rewrite product category CRUD methods. |
||
216 | * |
||
217 | * @return \TechDivision\Import\Product\Actions\UrlRewriteProductCategoryAction The action instance |
||
218 | */ |
||
219 | public function getUrlRewriteProductCategoryAction() |
||
223 | |||
224 | /** |
||
225 | * Set's the repository to load the product varchar attribute with. |
||
226 | * |
||
227 | * @param \TechDivision\Import\Product\Repositories\ProductVarcharRepository $productVarcharRepository The repository instance |
||
228 | * |
||
229 | * @return void |
||
230 | */ |
||
231 | public function setProductVarcharRepository($productVarcharRepository) |
||
235 | |||
236 | /** |
||
237 | * Return's the repository to load the product varchar attribute with. |
||
238 | * |
||
239 | * @return \TechDivision\Import\Product\Repositories\ProductVarcharRepository The repository instance |
||
240 | */ |
||
241 | public function getProductVarcharRepository() |
||
245 | |||
246 | /** |
||
247 | * Set's the repository to load the URL rewrites with. |
||
248 | * |
||
249 | * @param \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteRepository $urlRewriteRepository The repository instance |
||
250 | * |
||
251 | * @return void |
||
252 | */ |
||
253 | public function setUrlRewriteRepository($urlRewriteRepository) |
||
257 | |||
258 | /** |
||
259 | * Return's the repository to load the URL rewrites with. |
||
260 | * |
||
261 | * @return \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteRepository The repository instance |
||
262 | */ |
||
263 | public function getUrlRewriteRepository() |
||
267 | |||
268 | /** |
||
269 | * Set's the repository to load the URL rewrite product category relations with. |
||
270 | * |
||
271 | * @param \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteProductCategoryRepository $urlRewriteProductCategoryRepository The repository instance |
||
272 | * |
||
273 | * @return void |
||
274 | */ |
||
275 | public function setUrlRewriteProductCategoryRepository($urlRewriteProductCategoryRepository) |
||
279 | |||
280 | /** |
||
281 | * Return's the repository to load the URL rewrite product category relations with. |
||
282 | * |
||
283 | * @return \TechDivision\Import\Product\UrlRewrite\Repositories\UrlRewriteProductCategoryRepository The repository instance |
||
284 | */ |
||
285 | public function getUrlRewriteProductCategoryRepository() |
||
289 | |||
290 | /** |
||
291 | * Set's the repository to load the products with. |
||
292 | * |
||
293 | * @param \TechDivision\Import\Product\Repositories\ProductRepository $productRepository The repository instance |
||
294 | * |
||
295 | * @return void |
||
296 | */ |
||
297 | public function setProductRepository($productRepository) |
||
301 | |||
302 | /** |
||
303 | * Return's the repository to load the products with. |
||
304 | * |
||
305 | * @return \TechDivision\Import\Product\Repositories\ProductRepository The repository instance |
||
306 | */ |
||
307 | public function getProductRepository() |
||
311 | |||
312 | /** |
||
313 | * Return's the URL rewrites for the passed URL entity type and ID. |
||
314 | * |
||
315 | * @param string $entityType The entity type to load the URL rewrites for |
||
316 | * @param integer $entityId The entity ID to laod the rewrites for |
||
317 | * |
||
318 | * @return array The URL rewrites |
||
319 | */ |
||
320 | public function getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId) |
||
324 | |||
325 | /** |
||
326 | * Return's the URL rewrites for the passed URL entity type and ID. |
||
327 | * |
||
328 | * @param string $entityType The entity type to load the URL rewrites for |
||
329 | * @param integer $entityId The entity ID to load the URL rewrites for |
||
330 | * @param integer $storeId The store ID to load the URL rewrites for |
||
331 | * |
||
332 | * @return array The URL rewrites |
||
333 | */ |
||
334 | public function getUrlRewritesByEntityTypeAndEntityIdAndStoreId($entityType, $entityId, $storeId) |
||
338 | |||
339 | /** |
||
340 | * Return's an array with the URL rewrites for the passed SKU. |
||
341 | * |
||
342 | * @param string $sku The SKU to load the URL rewrites for |
||
343 | * |
||
344 | * @return array The URL rewrites |
||
345 | */ |
||
346 | public function getUrlRewritesBySku($sku) |
||
350 | |||
351 | /** |
||
352 | * Return's an array with the URL rewrite product category relations for the passed SKU. |
||
353 | * |
||
354 | * @param string $sku The SKU to load the URL rewrite product category relations for |
||
355 | * |
||
356 | * @return array The URL rewrite product category relations |
||
357 | */ |
||
358 | public function getUrlRewriteProductCategoriesBySku($sku) |
||
362 | |||
363 | /** |
||
364 | * Load's and return's the product with the passed SKU. |
||
365 | * |
||
366 | * @param string $sku The SKU of the product to load |
||
367 | * |
||
368 | * @return array The product |
||
369 | */ |
||
370 | public function loadProduct($sku) |
||
374 | |||
375 | /** |
||
376 | * Load's and return's the varchar attribute with the passed params. |
||
377 | * |
||
378 | * @param integer $attributeCode The attribute code of the varchar attribute |
||
379 | * @param integer $entityTypeId The entity type ID of the varchar attribute |
||
380 | * @param integer $storeId The store ID of the varchar attribute |
||
381 | * @param string $value The value of the varchar attribute |
||
382 | * |
||
383 | * @return array|null The varchar attribute |
||
384 | */ |
||
385 | public function loadProductVarcharAttributeByAttributeCodeAndEntityTypeIdAndStoreIdAndValue($attributeCode, $entityTypeId, $storeId, $value) |
||
389 | |||
390 | /** |
||
391 | * Return's the URL rewrite product category relation for the passed |
||
392 | * URL rewrite ID. |
||
393 | * |
||
394 | * @param integer $urlRewriteId The URL rewrite ID to load the URL rewrite product category relation for |
||
395 | * |
||
396 | * @return array|false The URL rewrite product category relation |
||
397 | */ |
||
398 | public function loadUrlRewriteProductCategory($urlRewriteId) |
||
402 | |||
403 | /** |
||
404 | * Persist's the URL write with the passed data. |
||
405 | * |
||
406 | * @param array $row The URL rewrite to persist |
||
407 | * @param string|null $name The name of the prepared statement that has to be executed |
||
408 | * |
||
409 | * @return string The ID of the persisted entity |
||
410 | */ |
||
411 | public function persistUrlRewrite($row, $name = null) |
||
415 | |||
416 | /** |
||
417 | * Persist's the URL rewrite product => category relation with the passed data. |
||
418 | * |
||
419 | * @param array $row The URL rewrite product => category relation to persist |
||
420 | * @param string|null $name The name of the prepared statement that has to be executed |
||
421 | * |
||
422 | * @return void |
||
423 | */ |
||
424 | public function persistUrlRewriteProductCategory($row, $name = null) |
||
428 | |||
429 | /** |
||
430 | * Delete's the URL rewrite with the passed attributes. |
||
431 | * |
||
432 | * @param array $row The attributes of the entity to delete |
||
433 | * @param string|null $name The name of the prepared statement that has to be executed |
||
434 | * |
||
435 | * @return void |
||
436 | */ |
||
437 | public function deleteUrlRewrite($row, $name = null) |
||
441 | } |
||
442 |
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: