1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Services\EeProductBunchProcessorFactory |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli\Services; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Configuration\ProcessorConfigurationInterface; |
24
|
|
|
use TechDivision\Import\Product\Ee\Repositories\ProductDatetimeRepository; |
25
|
|
|
use TechDivision\Import\Product\Ee\Repositories\ProductDecimalRepository; |
26
|
|
|
use TechDivision\Import\Product\Ee\Repositories\ProductIntRepository; |
27
|
|
|
use TechDivision\Import\Product\Ee\Repositories\ProductTextRepository; |
28
|
|
|
use TechDivision\Import\Product\Ee\Repositories\ProductVarcharRepository; |
29
|
|
|
use TechDivision\Import\Product\Ee\Actions\SequenceProductAction; |
30
|
|
|
use TechDivision\Import\Product\Ee\Actions\Processors\ProductUpdateProcessor; |
31
|
|
|
use TechDivision\Import\Product\Ee\Actions\Processors\SequenceProductCreateProcessor; |
32
|
|
|
use TechDivision\Import\Repositories\EavAttributeOptionValueRepository; |
33
|
|
|
use TechDivision\Import\Repositories\EavAttributeRepository; |
34
|
|
|
use TechDivision\Import\Product\Repositories\ProductRepository; |
35
|
|
|
use TechDivision\Import\Product\Repositories\ProductWebsiteRepository; |
36
|
|
|
use TechDivision\Import\Product\Repositories\CategoryProductRepository; |
37
|
|
|
use TechDivision\Import\Product\Repositories\StockStatusRepository; |
38
|
|
|
use TechDivision\Import\Product\Repositories\StockItemRepository; |
39
|
|
|
use TechDivision\Import\Repositories\UrlRewriteRepository; |
40
|
|
|
use TechDivision\Import\Product\Repositories\UrlRewriteProductCategoryRepository; |
41
|
|
|
use TechDivision\Import\Product\Actions\CategoryProductAction; |
42
|
|
|
use TechDivision\Import\Product\Actions\ProductDatetimeAction; |
43
|
|
|
use TechDivision\Import\Product\Actions\ProductDecimalAction; |
44
|
|
|
use TechDivision\Import\Product\Actions\ProductIntAction; |
45
|
|
|
use TechDivision\Import\Product\Actions\ProductTextAction; |
46
|
|
|
use TechDivision\Import\Product\Actions\ProductVarcharAction; |
47
|
|
|
use TechDivision\Import\Product\Actions\ProductAction; |
48
|
|
|
use TechDivision\Import\Product\Actions\ProductWebsiteAction; |
49
|
|
|
use TechDivision\Import\Product\Actions\StockItemAction; |
50
|
|
|
use TechDivision\Import\Product\Actions\StockStatusAction; |
51
|
|
|
use TechDivision\Import\Actions\UrlRewriteAction; |
52
|
|
|
use TechDivision\Import\Product\Actions\UrlRewriteProductCategoryAction; |
53
|
|
|
use TechDivision\Import\Product\Actions\Processors\CategoryProductCreateProcessor; |
54
|
|
|
use TechDivision\Import\Product\Actions\Processors\CategoryProductUpdateProcessor; |
55
|
|
|
use TechDivision\Import\Product\Actions\Processors\CategoryProductDeleteProcessor; |
56
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductDatetimeCreateProcessor; |
57
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductDatetimeUpdateProcessor; |
58
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductDecimalCreateProcessor; |
59
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductDecimalUpdateProcessor; |
60
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductIntCreateProcessor; |
61
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductIntUpdateProcessor; |
62
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductTextCreateProcessor; |
63
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductTextUpdateProcessor; |
64
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductVarcharCreateProcessor; |
65
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductVarcharUpdateProcessor; |
66
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductCreateProcessor; |
67
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductDeleteProcessor; |
68
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductWebsiteCreateProcessor; |
69
|
|
|
use TechDivision\Import\Product\Actions\Processors\ProductWebsiteDeleteProcessor; |
70
|
|
|
use TechDivision\Import\Product\Actions\Processors\StockItemCreateProcessor; |
71
|
|
|
use TechDivision\Import\Product\Actions\Processors\StockItemUpdateProcessor; |
72
|
|
|
use TechDivision\Import\Product\Actions\Processors\StockItemDeleteProcessor; |
73
|
|
|
use TechDivision\Import\Product\Actions\Processors\StockStatusCreateProcessor; |
74
|
|
|
use TechDivision\Import\Product\Actions\Processors\StockStatusUpdateProcessor; |
75
|
|
|
use TechDivision\Import\Product\Actions\Processors\StockStatusDeleteProcessor; |
76
|
|
|
use TechDivision\Import\Actions\Processors\UrlRewriteCreateProcessor; |
77
|
|
|
use TechDivision\Import\Actions\Processors\UrlRewriteUpdateProcessor; |
78
|
|
|
use TechDivision\Import\Actions\Processors\UrlRewriteDeleteProcessor; |
79
|
|
|
use TechDivision\Import\Product\Actions\Processors\UrlRewriteProductCategoryCreateProcessor; |
80
|
|
|
use TechDivision\Import\Product\Actions\Processors\UrlRewriteProductCategoryUpdateProcessor; |
81
|
|
|
use TechDivision\Import\Product\Actions\Processors\UrlRewriteProductCategoryDeleteProcessor; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* A SLSB providing methods to load product data using a PDO connection. |
85
|
|
|
* |
86
|
|
|
* @author Tim Wagner <[email protected]> |
87
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
88
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
89
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
90
|
|
|
* @link http://www.techdivision.com |
91
|
|
|
*/ |
92
|
|
|
class EeProductBunchProcessorFactory extends ProductBunchProcessorFactory |
93
|
|
|
{ |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Return's the processor class name. |
97
|
|
|
* |
98
|
|
|
* @return string The processor class name |
99
|
|
|
*/ |
100
|
|
|
protected static function getProcessorType() |
101
|
|
|
{ |
102
|
|
|
return 'TechDivision\Import\Product\Ee\Services\EeProductBunchProcessor'; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Factory method to create a new product processor instance. |
107
|
|
|
* |
108
|
|
|
* @param \PDO $connection The PDO connection to use |
109
|
|
|
* @param TechDivision\Import\Configuration\ProcessorConfigurationInterface $configuration The subject configuration |
110
|
|
|
* |
111
|
|
|
* @return \TechDivision\Import\Product\Services\ProductProcessor The processor instance |
112
|
|
|
*/ |
113
|
|
|
public static function factory(\PDO $connection, ProcessorConfigurationInterface $configuration) |
114
|
|
|
{ |
115
|
|
|
|
116
|
|
|
// load the utility class name |
117
|
|
|
$utilityClassName = $configuration->getUtilityClassName(); |
118
|
|
|
|
119
|
|
|
// initialize the repository that provides EAV attribute option value query functionality |
120
|
|
|
$eavAttributeOptionValueRepository = new EavAttributeOptionValueRepository($connection, $utilityClassName); |
|
|
|
|
121
|
|
|
|
122
|
|
|
// initialize the repository that provides EAV attribute query functionality |
123
|
|
|
$eavAttributeRepository = new EavAttributeRepository($connection, $utilityClassName); |
|
|
|
|
124
|
|
|
|
125
|
|
|
// initialize the repository that provides product query functionality |
126
|
|
|
$productRepository = new ProductRepository($connection, $utilityClassName); |
|
|
|
|
127
|
|
|
|
128
|
|
|
// initialize the repository that provides product website relation query functionality |
129
|
|
|
$productWebsiteRepository = new ProductWebsiteRepository($connection, $utilityClassName); |
|
|
|
|
130
|
|
|
|
131
|
|
|
// initialize the repository that provides product datetime attribute query functionality |
132
|
|
|
$productDatetimeRepository = new ProductDatetimeRepository($connection, $utilityClassName); |
|
|
|
|
133
|
|
|
|
134
|
|
|
// initialize the repository that provides product decimal attribute query functionality |
135
|
|
|
$productDecimalRepository = new ProductDecimalRepository($connection, $utilityClassName); |
|
|
|
|
136
|
|
|
|
137
|
|
|
// initialize the repository that provides product integer attribute query functionality |
138
|
|
|
$productIntRepository = new ProductIntRepository($connection, $utilityClassName); |
|
|
|
|
139
|
|
|
|
140
|
|
|
// initialize the repository that provides product text attribute query functionality |
141
|
|
|
$productTextRepository = new ProductTextRepository($connection, $utilityClassName); |
|
|
|
|
142
|
|
|
|
143
|
|
|
// initialize the repository that provides product varchar attribute query functionality |
144
|
|
|
$productVarcharRepository = new ProductVarcharRepository($connection, $utilityClassName); |
|
|
|
|
145
|
|
|
|
146
|
|
|
// initialize the repository that provides category product relation query functionality |
147
|
|
|
$categoryProductRepository = new CategoryProductRepository($connection, $utilityClassName); |
|
|
|
|
148
|
|
|
|
149
|
|
|
// initialize the repository that provides stock status query functionality |
150
|
|
|
$stockStatusRepository = new StockStatusRepository($connection, $utilityClassName); |
|
|
|
|
151
|
|
|
|
152
|
|
|
// initialize the repository that provides stock item query functionality |
153
|
|
|
$stockItemRepository = new StockItemRepository($connection, $utilityClassName); |
|
|
|
|
154
|
|
|
|
155
|
|
|
// initialize the repository that provides URL rewrite query functionality |
156
|
|
|
$urlRewriteRepository = new UrlRewriteRepository($connection, $utilityClassName); |
|
|
|
|
157
|
|
|
|
158
|
|
|
// initialize the repository that provides URL rewrite product category query functionality |
159
|
|
|
$urlRewriteProductCategoryRepository = new UrlRewriteProductCategoryRepository($connection, $utilityClassName); |
|
|
|
|
160
|
|
|
|
161
|
|
|
// initialize the action that provides sequence product CRUD functionality |
162
|
|
|
$sequenceProductAction = new SequenceProductAction( |
163
|
|
|
new SequenceProductCreateProcessor($connection, $utilityClassName) |
|
|
|
|
164
|
|
|
); |
165
|
|
|
|
166
|
|
|
// initialize the action that provides category product relation CRUD functionality |
167
|
|
|
$categoryProductAction = new CategoryProductAction( |
168
|
|
|
new CategoryProductCreateProcessor($connection, $utilityClassName), |
|
|
|
|
169
|
|
|
new CategoryProductUpdateProcessor($connection, $utilityClassName), |
|
|
|
|
170
|
|
|
new CategoryProductDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
171
|
|
|
); |
172
|
|
|
|
173
|
|
|
// initialize the action that provides product datetime attribute CRUD functionality |
174
|
|
|
$productDatetimeAction = new ProductDatetimeAction( |
175
|
|
|
new ProductDatetimeCreateProcessor($connection, $utilityClassName), |
|
|
|
|
176
|
|
|
new ProductDatetimeUpdateProcessor($connection, $utilityClassName) |
|
|
|
|
177
|
|
|
); |
178
|
|
|
|
179
|
|
|
// initialize the action that provides product decimal attribute CRUD functionality |
180
|
|
|
$productDecimalAction = new ProductDecimalAction( |
181
|
|
|
new ProductDecimalCreateProcessor($connection, $utilityClassName), |
|
|
|
|
182
|
|
|
new ProductDecimalUpdateProcessor($connection, $utilityClassName) |
|
|
|
|
183
|
|
|
); |
184
|
|
|
|
185
|
|
|
// initialize the action that provides product integer attribute CRUD functionality |
186
|
|
|
$productIntAction = new ProductIntAction( |
187
|
|
|
new ProductIntCreateProcessor($connection, $utilityClassName), |
|
|
|
|
188
|
|
|
new ProductIntUpdateProcessor($connection, $utilityClassName) |
|
|
|
|
189
|
|
|
); |
190
|
|
|
|
191
|
|
|
// initialize the action that provides product text attribute CRUD functionality |
192
|
|
|
$productTextAction = new ProductTextAction( |
193
|
|
|
new ProductTextCreateProcessor($connection, $utilityClassName), |
|
|
|
|
194
|
|
|
new ProductTextUpdateProcessor($connection, $utilityClassName) |
|
|
|
|
195
|
|
|
); |
196
|
|
|
|
197
|
|
|
// initialize the action that provides product varchar attribute CRUD functionality |
198
|
|
|
$productVarcharAction = new ProductVarcharAction( |
199
|
|
|
new ProductVarcharCreateProcessor($connection, $utilityClassName), |
|
|
|
|
200
|
|
|
new ProductVarcharUpdateProcessor($connection, $utilityClassName) |
|
|
|
|
201
|
|
|
); |
202
|
|
|
|
203
|
|
|
// initialize the action that provides product CRUD functionality |
204
|
|
|
$productAction = new ProductAction( |
205
|
|
|
new ProductCreateProcessor($connection, $utilityClassName), |
|
|
|
|
206
|
|
|
new ProductUpdateProcessor($connection, $utilityClassName), |
|
|
|
|
207
|
|
|
new ProductDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
208
|
|
|
); |
209
|
|
|
|
210
|
|
|
// initialize the action that provides provides product website CRUD functionality |
211
|
|
|
$productWebsiteAction = new ProductWebsiteAction( |
212
|
|
|
new ProductWebsiteCreateProcessor($connection, $utilityClassName), |
|
|
|
|
213
|
|
|
null, |
214
|
|
|
new ProductWebsiteDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
215
|
|
|
); |
216
|
|
|
|
217
|
|
|
// initialize the action that provides stock item CRUD functionality |
218
|
|
|
$stockItemAction = new StockItemAction( |
219
|
|
|
new StockItemCreateProcessor($connection, $utilityClassName), |
|
|
|
|
220
|
|
|
new StockItemUpdateProcessor($connection, $utilityClassName), |
|
|
|
|
221
|
|
|
new StockItemDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
222
|
|
|
); |
223
|
|
|
|
224
|
|
|
// initialize the action that provides stock status CRUD functionality |
225
|
|
|
$stockStatusAction = new StockStatusAction( |
226
|
|
|
new StockStatusCreateProcessor($connection, $utilityClassName), |
|
|
|
|
227
|
|
|
new StockStatusUpdateProcessor($connection, $utilityClassName), |
|
|
|
|
228
|
|
|
new StockStatusDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
229
|
|
|
); |
230
|
|
|
|
231
|
|
|
// initialize the action that provides URL rewrite CRUD functionality |
232
|
|
|
$urlRewriteAction = new UrlRewriteAction( |
233
|
|
|
new UrlRewriteCreateProcessor($connection, $utilityClassName), |
|
|
|
|
234
|
|
|
new UrlRewriteUpdateProcessor($connection, $utilityClassName), |
|
|
|
|
235
|
|
|
new UrlRewriteDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
236
|
|
|
); |
237
|
|
|
|
238
|
|
|
// initialize the action that provides URL rewrite CRUD functionality |
239
|
|
|
$urlRewriteProductCategoryAction = new UrlRewriteProductCategoryAction( |
240
|
|
|
new UrlRewriteProductCategoryCreateProcessor($connection, $utilityClassName), |
|
|
|
|
241
|
|
|
new UrlRewriteProductCategoryUpdateProcessor($connection, $utilityClassName), |
|
|
|
|
242
|
|
|
new UrlRewriteProductCategoryDeleteProcessor($connection, $utilityClassName) |
|
|
|
|
243
|
|
|
); |
244
|
|
|
|
245
|
|
|
// initialize the product processor |
246
|
|
|
$processorType = static::getProcessorType(); |
247
|
|
|
return new $processorType( |
248
|
|
|
$connection, |
249
|
|
|
$sequenceProductAction, |
250
|
|
|
$productRepository, |
251
|
|
|
$productWebsiteRepository, |
252
|
|
|
$productDatetimeRepository, |
253
|
|
|
$productDecimalRepository, |
254
|
|
|
$productIntRepository, |
255
|
|
|
$productTextRepository, |
256
|
|
|
$productVarcharRepository, |
257
|
|
|
$categoryProductRepository, |
258
|
|
|
$stockStatusRepository, |
259
|
|
|
$stockItemRepository, |
260
|
|
|
$urlRewriteRepository, |
261
|
|
|
$urlRewriteProductCategoryRepository, |
262
|
|
|
$eavAttributeOptionValueRepository, |
263
|
|
|
$eavAttributeRepository, |
264
|
|
|
$categoryProductAction, |
265
|
|
|
$productDatetimeAction, |
266
|
|
|
$productDecimalAction, |
267
|
|
|
$productIntAction, |
268
|
|
|
$productAction, |
269
|
|
|
$productTextAction, |
270
|
|
|
$productVarcharAction, |
271
|
|
|
$productWebsiteAction, |
272
|
|
|
$stockItemAction, |
273
|
|
|
$stockStatusAction, |
274
|
|
|
$urlRewriteAction, |
275
|
|
|
$urlRewriteProductCategoryAction |
276
|
|
|
); |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.