1 | <?php |
||
44 | class UrlKeyAndPathObserver extends AbstractCategoryImportObserver |
||
45 | { |
||
46 | |||
47 | /** |
||
48 | * The trait that provides string => URL key conversion functionality. |
||
49 | * |
||
50 | * @var \TechDivision\Import\Utils\Filter\UrlKeyFilterTrait |
||
51 | */ |
||
52 | use UrlKeyFilterTrait; |
||
53 | |||
54 | /** |
||
55 | * The URL key utility instance. |
||
56 | * |
||
57 | * @var \TechDivision\Import\Utils\UrlKeyUtilInterface |
||
58 | */ |
||
59 | protected $urlKeyUtil; |
||
60 | |||
61 | /** |
||
62 | * The category bunch processor instance. |
||
63 | * |
||
64 | * @var \TechDivision\Import\Category\Services\CategoryBunchProcessorInterface |
||
65 | */ |
||
66 | protected $categoryBunchProcessor; |
||
67 | |||
68 | /** |
||
69 | * The reverse sequence generator instance. |
||
70 | * |
||
71 | * @var \TechDivision\Import\Utils\Generators\GeneratorInterface |
||
72 | */ |
||
73 | protected $reverseSequenceGenerator; |
||
74 | |||
75 | /** |
||
76 | * Initialize the observer with the passed product bunch processor instance. |
||
77 | * |
||
78 | * @param \TechDivision\Import\Category\Services\CategoryBunchProcessorInterface $categoryBunchProcessor The category bunch processor instance |
||
79 | * @param \Zend\Filter\FilterInterface $convertLiteralUrlFilter The URL filter instance |
||
80 | * @param \TechDivision\Import\Utils\UrlKeyUtilInterface $urlKeyUtil The URL key utility instance |
||
81 | * @param \TechDivision\Import\Utils\Generators\GeneratorInterface $reverseSequenceGenerator The reverse sequence generator instance |
||
82 | */ |
||
83 | public function __construct( |
||
96 | |||
97 | /** |
||
98 | * Process the observer's business logic. |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | protected function process() |
||
196 | |||
197 | /** |
||
198 | * Return the primary key member name. |
||
199 | * |
||
200 | * @return string The primary key member name |
||
201 | */ |
||
202 | protected function getPkMemberName() |
||
206 | |||
207 | /** |
||
208 | * Returns the category bunch processor instance. |
||
209 | * |
||
210 | * @return \TechDivision\Import\Category\Services\CategoryBunchProcessorInterface The category bunch processor instance |
||
211 | */ |
||
212 | protected function getCategoryBunchProcessor() |
||
216 | |||
217 | /** |
||
218 | * Returns the URL key utility instance. |
||
219 | * |
||
220 | * @return \TechDivision\Import\Utils\UrlKeyUtilInterface The URL key utility instance |
||
221 | */ |
||
222 | protected function getUrlKeyUtil() |
||
226 | |||
227 | /** |
||
228 | * Returns the reverse sequence generator instance. |
||
229 | * |
||
230 | * @return \TechDivision\Import\Utils\Generators\GeneratorInterface The reverse sequence generator |
||
231 | */ |
||
232 | protected function getReverseSequenceGenerator() : GeneratorInterface |
||
236 | |||
237 | /** |
||
238 | * Return's the category with the passed path. |
||
239 | * |
||
240 | * @param string $path The path of the category to return |
||
241 | * |
||
242 | * @return array The category |
||
243 | * @throws \Exception Is thrown, if the requested category is not available |
||
244 | */ |
||
245 | protected function getCategoryByPath($path) |
||
249 | |||
250 | /** |
||
251 | * Returns the category with the passed primary key and the attribute values for the passed store ID. |
||
252 | * |
||
253 | * @param string $pk The primary key of the category to return |
||
254 | * @param integer $storeId The store ID of the category values |
||
255 | * |
||
256 | * @return array|null The category data |
||
257 | */ |
||
258 | protected function getCategoryByPkAndStoreId($pk, $storeId) |
||
262 | |||
263 | /** |
||
264 | * Temporarily persist's the IDs of the passed category. |
||
265 | * |
||
266 | * @param array $category The category to temporarily persist the IDs for |
||
267 | * |
||
268 | * @return void |
||
269 | */ |
||
270 | protected function setIds(array $category) |
||
274 | |||
275 | /** |
||
276 | * Set's the ID of the category that has been created recently. |
||
277 | * |
||
278 | * @param string $lastEntityId The entity ID |
||
279 | * |
||
280 | * @return void |
||
281 | */ |
||
282 | protected function setLastEntityId($lastEntityId) |
||
286 | |||
287 | /** |
||
288 | * Return's the PK to of the product. |
||
289 | * |
||
290 | * @return integer The PK to create the relation with |
||
291 | */ |
||
292 | protected function getPrimaryKey() |
||
296 | |||
297 | /** |
||
298 | * Load's and return's the url_key with the passed primary ID. |
||
299 | * |
||
300 | * @param \TechDivision\Import\Subjects\UrlKeyAwareSubjectInterface $subject The subject to load the URL key |
||
301 | * @param int $primaryKeyId The ID from category |
||
302 | * |
||
303 | * @return string|null url_key or null |
||
304 | */ |
||
305 | protected function loadUrlKey(UrlKeyAwareSubjectInterface $subject, $primaryKeyId) |
||
309 | |||
310 | /** |
||
311 | * Make's the passed URL key unique by adding the next number to the end. |
||
312 | * |
||
313 | * @param \TechDivision\Import\Subjects\UrlKeyAwareSubjectInterface $subject The subject to make the URL key unique for |
||
314 | * @param array $entity The entity to make the URL key unique for |
||
315 | * @param string $urlKey The URL key to make unique |
||
316 | * @param array $urlPaths The URL paths to make unique |
||
317 | * |
||
318 | * @return string The unique URL key |
||
319 | */ |
||
320 | protected function makeUnique(UrlKeyAwareSubjectInterface $subject, array $entity, string $urlKey, array $urlPaths = array()) |
||
324 | } |
||
325 |
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: