1 | <?php |
||
46 | class UrlKeyObserver extends AbstractProductImportObserver implements ObserverFactoryInterface |
||
47 | { |
||
48 | |||
49 | /** |
||
50 | * The trait that provides string => URL key conversion functionality. |
||
51 | * |
||
52 | * @var \TechDivision\Import\Utils\Filter\UrlKeyFilterTrait |
||
53 | */ |
||
54 | use UrlKeyFilterTrait; |
||
55 | |||
56 | /** |
||
57 | * The URL key utility instance. |
||
58 | * |
||
59 | * @var \TechDivision\Import\Utils\UrlKeyUtilInterface |
||
60 | */ |
||
61 | protected $urlKeyUtil; |
||
62 | |||
63 | /** |
||
64 | * The product bunch processor instance. |
||
65 | * |
||
66 | * @var \TechDivision\Import\Product\Services\ProductBunchProcessorInterface |
||
67 | */ |
||
68 | protected $productBunchProcessor; |
||
69 | |||
70 | /** |
||
71 | * The reverse sequence generator instance. |
||
72 | * |
||
73 | * @var \TechDivision\Import\Utils\Generators\GeneratorInterface |
||
74 | */ |
||
75 | protected $reverseSequenceGenerator; |
||
76 | |||
77 | /** |
||
78 | * The array with the root categories. |
||
79 | * |
||
80 | * @var array |
||
81 | */ |
||
82 | protected $rootCategories = array(); |
||
83 | |||
84 | /** |
||
85 | * Initialize the observer with the passed product bunch processor and filter instance. |
||
86 | * |
||
87 | * @param \TechDivision\Import\Product\Services\ProductBunchProcessorInterface $productBunchProcessor The product bunch processor instance |
||
88 | * @param \Zend\Filter\FilterInterface $convertLiteralUrlFilter The URL filter instance |
||
89 | * @param \TechDivision\Import\Utils\UrlKeyUtilInterface $urlKeyUtil The URL key utility instance |
||
90 | * @param \TechDivision\Import\Utils\Generators\GeneratorInterface $reverseSequenceGenerator The reverse sequence generator instance |
||
91 | */ |
||
92 | public function __construct( |
||
103 | |||
104 | /** |
||
105 | * Will be invoked by the observer visitor when a factory has been defined to create the observer instance. |
||
106 | * |
||
107 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
108 | * |
||
109 | * @return \TechDivision\Import\Observers\ObserverInterface The observer instance |
||
110 | */ |
||
111 | public function createObserver(SubjectInterface $subject) |
||
126 | |||
127 | /** |
||
128 | * Return's the product bunch processor instance. |
||
129 | * |
||
130 | * @return \TechDivision\Import\Product\Services\ProductBunchProcessorInterface The product bunch processor instance |
||
131 | */ |
||
132 | protected function getProductBunchProcessor() : ProductBunchProcessorInterface |
||
136 | |||
137 | /** |
||
138 | * Returns the URL key utility instance. |
||
139 | * |
||
140 | * @return \TechDivision\Import\Utils\UrlKeyUtilInterface The URL key utility instance |
||
141 | */ |
||
142 | protected function getUrlKeyUtil() : UrlKeyUtilInterface |
||
146 | |||
147 | /** |
||
148 | * Returns the reverse sequence generator instance. |
||
149 | * |
||
150 | * @return \TechDivision\Import\Utils\Generators\GeneratorInterface The reverse sequence generator |
||
151 | */ |
||
152 | protected function getReverseSequenceGenerator() : GeneratorInterface |
||
156 | |||
157 | /** |
||
158 | * Process the observer's business logic. |
||
159 | * |
||
160 | * @return void |
||
161 | * @throws \Exception Is thrown, if either column "url_key" or "name" have a value set |
||
162 | */ |
||
163 | protected function process() |
||
215 | |||
216 | /** |
||
217 | * Extract's the category from the comma separeted list of categories |
||
218 | * in column `categories` and return's an array with their URL paths. |
||
219 | * |
||
220 | * @return string[] Array with the URL paths of the categories found in column `categories` |
||
221 | */ |
||
222 | protected function getUrlPaths() |
||
248 | |||
249 | /** |
||
250 | * Recursively resolves an array with the store view specific |
||
251 | * URL paths of the passed category. |
||
252 | * |
||
253 | * @param array $urlPaths The array to append the URL paths to |
||
254 | * @param array $category The category to resolve the list with URL paths |
||
255 | * @param string $storeViewCode The store view code to resolve the URL paths for |
||
256 | * @param bool $directRelation the flag whether or not the passed category is a direct relation to the product and has to added to the list |
||
257 | * |
||
258 | * @return void |
||
259 | */ |
||
260 | protected function resolveUrlPaths(array &$urlPaths, array $category, string $storeViewCode, bool $directRelation = true) |
||
287 | |||
288 | /** |
||
289 | * Temporarily persist's the IDs of the passed product. |
||
290 | * |
||
291 | * @param array $product The product to temporarily persist the IDs for |
||
292 | * |
||
293 | * @return void |
||
294 | */ |
||
295 | protected function setIds(array $product) |
||
299 | |||
300 | /** |
||
301 | * Set's the ID of the product that has been created recently. |
||
302 | * |
||
303 | * @param string $lastEntityId The entity ID |
||
304 | * |
||
305 | * @return void |
||
306 | */ |
||
307 | protected function setLastEntityId($lastEntityId) |
||
311 | |||
312 | /** |
||
313 | * Return's the PK to of the product. |
||
314 | * |
||
315 | * @return integer The PK to create the relation with |
||
316 | */ |
||
317 | protected function getPrimaryKey() |
||
321 | |||
322 | /** |
||
323 | * Load's and return's the product with the passed SKU. |
||
324 | * |
||
325 | * @param string $sku The SKU of the product to load |
||
326 | * |
||
327 | * @return array The product |
||
328 | */ |
||
329 | protected function loadProduct($sku) |
||
333 | |||
334 | /** |
||
335 | * Load's and return's the url_key with the passed primary ID. |
||
336 | * |
||
337 | * @param \TechDivision\Import\Subjects\UrlKeyAwareSubjectInterface $subject The subject to load the URL key |
||
338 | * @param int $primaryKeyId The ID from product |
||
339 | * |
||
340 | * @return string|null url_key or null |
||
341 | */ |
||
342 | protected function loadUrlKey(UrlKeyAwareSubjectInterface $subject, $primaryKeyId) |
||
346 | |||
347 | /** |
||
348 | * Return's the category with the passed path. |
||
349 | * |
||
350 | * @param string $path The path of the category to return |
||
351 | * @param string $storeViewCode The code of a store view, defaults to admin |
||
352 | * |
||
353 | * @return array The category |
||
354 | */ |
||
355 | protected function getCategoryByPath($path, $storeViewCode = StoreViewCodes::ADMIN) |
||
359 | |||
360 | /** |
||
361 | * Make's the passed URL key unique by adding the next number to the end. |
||
362 | * |
||
363 | * @param \TechDivision\Import\Subjects\UrlKeyAwareSubjectInterface $subject The subject to make the URL key unique for |
||
364 | * @param array $entity The entity to make the URL key unique for |
||
365 | * @param string $urlKey The URL key to make unique |
||
366 | * @param array $urlPaths The URL paths to make unique |
||
367 | * |
||
368 | * @return string The unique URL key |
||
369 | */ |
||
370 | protected function makeUnique(UrlKeyAwareSubjectInterface $subject, array $entity, string $urlKey, array $urlPaths = array()) |
||
374 | |||
375 | /** |
||
376 | * Return's the array with the root categories. |
||
377 | * |
||
378 | * @return array The array with the root categories |
||
379 | */ |
||
380 | public function getRootCategories() |
||
384 | |||
385 | /** |
||
386 | * Return's the category with the passed ID. |
||
387 | * |
||
388 | * @param integer $categoryId The ID of the category to return |
||
389 | * @param string $storeViewCode The code of a store view, defaults to "admin" |
||
390 | * |
||
391 | * @return array The category data |
||
392 | */ |
||
393 | protected function getCategory($categoryId, $storeViewCode = StoreViewCodes::ADMIN) |
||
397 | } |
||
398 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.