1 | <?php |
||
61 | class EeProductBunchProcessor extends ProductBunchProcessor implements EeProductBunchProcessorInterface |
||
62 | { |
||
63 | |||
64 | /** |
||
65 | * The action for sequence product CRUD methods. |
||
66 | * |
||
67 | * @var \TechDivision\Import\Product\Ee\Actions\SequenceProductAction |
||
68 | */ |
||
69 | protected $sequenceProductAction; |
||
70 | /** |
||
71 | * Initialize the processor with the necessary assembler and repository instances. |
||
72 | * |
||
73 | * @param \PDO $connection The PDO connection to use |
||
74 | * @param \TechDivision\Import\Product\Ee\Actions\SequenceProductAction $sequenceProductAction The sequence product action to use |
||
75 | * @param \TechDivision\Import\Product\Repositories\ProductRepository $productRepository The product repository to use |
||
76 | * @param \TechDivision\Import\Product\Repositories\ProductWebsiteRepository $productWebsiteRepository The product website repository to use |
||
77 | * @param \TechDivision\Import\Product\Repositories\ProductDatetimeRepository $productDatetimeRepository The product datetime repository to use |
||
78 | * @param \TechDivision\Import\Product\Repositories\ProductDecimalRepository $productDecimalRepository The product decimal repository to use |
||
79 | * @param \TechDivision\Import\Product\Repositories\ProductIntRepository $productIntRepository The product integer repository to use |
||
80 | * @param \TechDivision\Import\Product\Repositories\ProductTextRepository $productTextRepository The product text repository to use |
||
81 | * @param \TechDivision\Import\Product\Repositories\ProductVarcharRepository $productVarcharRepository The product varchar repository to use |
||
82 | * @param \TechDivision\Import\Product\Repositories\CategoryProductRepository $categoryProductRepository The category product repository to use |
||
83 | * @param \TechDivision\Import\Product\Repositories\StockStatusRepository $stockStatusRepository The stock status repository to use |
||
84 | * @param \TechDivision\Import\Product\Repositories\StockItemRepository $stockItemRepository The stock item repository to use |
||
85 | * @param \TechDivision\Import\Repositories\UrlRewriteRepository $urlRewriteRepository The URL rewrite repository to use |
||
86 | * @param \TechDivision\Import\Repositories\UrlRewriteRepository $urlRewriteProductCategoryRepository The URL rewrite product category repository to use |
||
87 | * @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository $eavAttributeOptionValueRepository The EAV attribute option value repository to use |
||
88 | * @param \TechDivision\Import\Repositories\EavAttributeRepository $eavAttributeRepository The EAV attribute repository to use |
||
89 | * @param \TechDivision\Import\Product\Actions\CategoryProductAction $categoryProductAction The category product action to use |
||
90 | * @param \TechDivision\Import\Product\Actions\ProductDatetimeAction $productDatetimeAction The product datetime action to use |
||
91 | * @param \TechDivision\Import\Product\Actions\ProductDecimalAction $productDecimalAction The product decimal action to use |
||
92 | * @param \TechDivision\Import\Product\Actions\ProductIntAction $productIntAction The product integer action to use |
||
93 | * @param \TechDivision\Import\Product\Actions\ProductAction $productAction The product action to use |
||
94 | * @param \TechDivision\Import\Product\Actions\ProductTextAction $productTextAction The product text action to use |
||
95 | * @param \TechDivision\Import\Product\Actions\ProductVarcharAction $productVarcharAction The product varchar action to use |
||
96 | * @param \TechDivision\Import\Product\Actions\ProductWebsiteAction $productWebsiteAction The product website action to use |
||
97 | * @param \TechDivision\Import\Product\Actions\StockItemAction $stockItemAction The stock item action to use |
||
98 | * @param \TechDivision\Import\Product\Actions\StockStatusAction $stockStatusAction The stock status action to use |
||
99 | * @param \TechDivision\Import\Actions\UrlRewriteAction $urlRewriteAction The URL rewrite action to use |
||
100 | * @param \TechDivision\Import\Product\Actions\UrlRewriteProductCategoryAction $urlRewriteProductCategoryAction The URL rewrite product category action to use |
||
101 | */ |
||
102 | public function __construct( |
||
167 | |||
168 | /** |
||
169 | * Set's the action with the sequence product CRUD methods. |
||
170 | * |
||
171 | * @param \TechDivision\Import\Product\Ee\Actions\SequenceProductAction $sequenceProductAction The action with the sequence product CRUD methods |
||
172 | * |
||
173 | * @return void |
||
174 | */ |
||
175 | public function setSequenceProductAction($sequenceProductAction) |
||
179 | |||
180 | /** |
||
181 | * Return's the action with the sequence product CRUD methods. |
||
182 | * |
||
183 | * @return \TechDivision\Import\Product\Ee\Actions\SequenceProductAction The action instance |
||
184 | */ |
||
185 | public function getSequenceProductAction() |
||
189 | |||
190 | /** |
||
191 | * Return's the next available product entity ID. |
||
192 | * |
||
193 | * @return integer The next available product entity ID |
||
194 | */ |
||
195 | public function nextIdentifier() |
||
199 | |||
200 | /** |
||
201 | * Load's and return's the datetime attribute with the passed row/attribute/store ID. |
||
202 | * |
||
203 | * @param integer $rowId The row ID of the attribute |
||
204 | * @param integer $attributeId The attribute ID of the attribute |
||
205 | * @param integer $storeId The store ID of the attribute |
||
206 | * |
||
207 | * @return array|null The datetime attribute |
||
208 | */ |
||
209 | public function loadProductDatetimeAttributeByRowIdAndAttributeIdAndStoreId($rowId, $attributeId, $storeId) |
||
213 | |||
214 | /** |
||
215 | * Load's and return's the decimal attribute with the passed row/attribute/store ID. |
||
216 | * |
||
217 | * @param integer $rowId The row ID of the attribute |
||
218 | * @param integer $attributeId The attribute ID of the attribute |
||
219 | * @param integer $storeId The store ID of the attribute |
||
220 | * |
||
221 | * @return array|null The decimal attribute |
||
222 | */ |
||
223 | public function loadProductDecimalAttributeByRowIdAndAttributeIdAndStoreId($rowId, $attributeId, $storeId) |
||
227 | |||
228 | /** |
||
229 | * Load's and return's the integer attribute with the passed row/attribute/store ID. |
||
230 | * |
||
231 | * @param integer $rowId The row ID of the attribute |
||
232 | * @param integer $attributeId The attribute ID of the attribute |
||
233 | * @param integer $storeId The store ID of the attribute |
||
234 | * |
||
235 | * @return array|null The integer attribute |
||
236 | */ |
||
237 | public function loadProductIntAttributeByRowIdAndAttributeIdAndStoreId($rowId, $attributeId, $storeId) |
||
241 | |||
242 | /** |
||
243 | * Load's and return's the text attribute with the passed row/attribute/store ID. |
||
244 | * |
||
245 | * @param integer $rowId The row ID of the attribute |
||
246 | * @param integer $attributeId The attribute ID of the attribute |
||
247 | * @param integer $storeId The store ID of the attribute |
||
248 | * |
||
249 | * @return array|null The text attribute |
||
250 | */ |
||
251 | public function loadProductTextAttributeByRowIdAndAttributeIdAndStoreId($rowId, $attributeId, $storeId) |
||
255 | |||
256 | /** |
||
257 | * Load's and return's the varchar attribute with the passed row/attribute/store ID. |
||
258 | * |
||
259 | * @param integer $rowId The row ID of the attribute |
||
260 | * @param integer $attributeId The attribute ID of the attribute |
||
261 | * @param integer $storeId The store ID of the attribute |
||
262 | * |
||
263 | * @return array|null The varchar attribute |
||
264 | */ |
||
265 | public function loadProductVarcharAttributeByRowIdAndAttributeIdAndStoreId($rowId, $attributeId, $storeId) |
||
269 | } |
||
270 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the parent class: