1 | <?php |
||
42 | class UrlKeyObserver extends AbstractProductImportObserver |
||
43 | { |
||
44 | |||
45 | /** |
||
46 | * The trait that provides string => URL key conversion functionality. |
||
47 | * |
||
48 | * @var \TechDivision\Import\Utils\Filter\UrlKeyFilterTrait |
||
49 | */ |
||
50 | use UrlKeyFilterTrait; |
||
51 | |||
52 | /** |
||
53 | * The URL key utility instance. |
||
54 | * |
||
55 | * @var \TechDivision\Import\Utils\UrlKeyUtilInterface |
||
56 | */ |
||
57 | protected $urlKeyUtil; |
||
58 | |||
59 | /** |
||
60 | * The product bunch processor instance. |
||
61 | * |
||
62 | * @var \TechDivision\Import\Product\Services\ProductBunchProcessorInterface |
||
63 | */ |
||
64 | protected $productBunchProcessor; |
||
65 | |||
66 | /** |
||
67 | * Initialize the observer with the passed product bunch processor and filter instance. |
||
68 | * |
||
69 | * @param \TechDivision\Import\Product\Services\ProductBunchProcessorInterface $productBunchProcessor The product bunch processor instance |
||
70 | * @param \Zend\Filter\FilterInterface $convertLiteralUrlFilter The URL filter instance |
||
71 | * @param \TechDivision\Import\Utils\UrlKeyUtilInterface $urlKeyUtil The URL key utility instance |
||
72 | */ |
||
73 | public function __construct( |
||
82 | |||
83 | /** |
||
84 | * Return's the product bunch processor instance. |
||
85 | * |
||
86 | * @return \TechDivision\Import\Product\Services\ProductBunchProcessorInterface The product bunch processor instance |
||
87 | */ |
||
88 | protected function getProductBunchProcessor() |
||
92 | |||
93 | /** |
||
94 | * Process the observer's business logic. |
||
95 | * |
||
96 | * @return void |
||
97 | * @throws \Exception Is thrown, if either column "url_key" or "name" have a value set |
||
98 | */ |
||
99 | protected function process() |
||
134 | |||
135 | /** |
||
136 | * Temporarily persist's the IDs of the passed product. |
||
137 | * |
||
138 | * @param array $product The product to temporarily persist the IDs for |
||
139 | * |
||
140 | * @return void |
||
141 | */ |
||
142 | protected function setIds(array $product) |
||
146 | |||
147 | /** |
||
148 | * Set's the ID of the product that has been created recently. |
||
149 | * |
||
150 | * @param string $lastEntityId The entity ID |
||
151 | * |
||
152 | * @return void |
||
153 | */ |
||
154 | protected function setLastEntityId($lastEntityId) |
||
158 | |||
159 | /** |
||
160 | * Load's and return's the product with the passed SKU. |
||
161 | * |
||
162 | * @param string $sku The SKU of the product to load |
||
163 | * |
||
164 | * @return array The product |
||
165 | */ |
||
166 | protected function loadProduct($sku) |
||
170 | |||
171 | /** |
||
172 | * Returns the URL key utility instance. |
||
173 | * |
||
174 | * @return \TechDivision\Import\Utils\UrlKeyUtilInterface The URL key utility instance |
||
175 | */ |
||
176 | protected function getUrlKeyUtil() |
||
180 | |||
181 | /** |
||
182 | * Make's the passed URL key unique by adding the next number to the end. |
||
183 | * |
||
184 | * @param \TechDivision\Import\Subjects\UrlKeyAwareSubjectInterface $subject The subject to make the URL key unique for |
||
185 | * @param string $urlKey The URL key to make unique |
||
186 | * |
||
187 | * @return string The unique URL key |
||
188 | */ |
||
189 | protected function makeUnique(UrlKeyAwareSubjectInterface $subject, $urlKey) |
||
193 | } |
||
194 |
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: