1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\Services\ProductBunchProcessor |
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-product |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Services; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Actions\ActionInterface; |
24
|
|
|
use TechDivision\Import\Connection\ConnectionInterface; |
25
|
|
|
use TechDivision\Import\Repositories\EavAttributeRepositoryInterface; |
26
|
|
|
use TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface; |
27
|
|
|
use TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface; |
28
|
|
|
use TechDivision\Import\Product\Utils\CacheKeys; |
29
|
|
|
use TechDivision\Import\Product\Repositories\ProductRepositoryInterface; |
30
|
|
|
use TechDivision\Import\Product\Repositories\StockItemRepositoryInterface; |
31
|
|
|
use TechDivision\Import\Product\Repositories\ProductIntRepositoryInterface; |
32
|
|
|
use TechDivision\Import\Product\Repositories\ProductTextRepositoryInterface; |
33
|
|
|
use TechDivision\Import\Product\Assemblers\ProductAttributeAssemblerInterface; |
34
|
|
|
use TechDivision\Import\Product\Repositories\ProductDecimalRepositoryInterface; |
35
|
|
|
use TechDivision\Import\Product\Repositories\ProductWebsiteRepositoryInterface; |
36
|
|
|
use TechDivision\Import\Product\Repositories\ProductDatetimeRepositoryInterface; |
37
|
|
|
use TechDivision\Import\Product\Repositories\ProductVarcharRepositoryInterface; |
38
|
|
|
use TechDivision\Import\Product\Repositories\CategoryProductRepositoryInterface; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* The product bunch processor implementation. |
42
|
|
|
* |
43
|
|
|
* @author Tim Wagner <[email protected]> |
44
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
45
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
46
|
|
|
* @link https://github.com/techdivision/import-product |
47
|
|
|
* @link http://www.techdivision.com |
48
|
|
|
*/ |
49
|
|
|
class ProductBunchProcessor implements ProductBunchProcessorInterface |
50
|
|
|
{ |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* A PDO connection initialized with the values from the Doctrine EntityManager. |
54
|
|
|
* |
55
|
|
|
* @var \TechDivision\Import\Connection\ConnectionInterface |
56
|
|
|
*/ |
57
|
|
|
protected $connection; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The repository to access EAV attribute option values. |
61
|
|
|
* |
62
|
|
|
* @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface |
63
|
|
|
*/ |
64
|
|
|
protected $eavAttributeOptionValueRepository; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* The repository to access EAV attributes. |
68
|
|
|
* |
69
|
|
|
* @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface |
70
|
|
|
*/ |
71
|
|
|
protected $eavAttributeRepository; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The action for product CRUD methods. |
75
|
|
|
* |
76
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
77
|
|
|
*/ |
78
|
|
|
protected $productAction; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* The action for product varchar attribute CRUD methods. |
82
|
|
|
* |
83
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
84
|
|
|
*/ |
85
|
|
|
protected $productVarcharAction; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* The action for product text attribute CRUD methods. |
89
|
|
|
* |
90
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
91
|
|
|
*/ |
92
|
|
|
protected $productTextAction; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* The action for product int attribute CRUD methods. |
96
|
|
|
* |
97
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
98
|
|
|
*/ |
99
|
|
|
protected $productIntAction; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* The action for product decimal attribute CRUD methods. |
103
|
|
|
* |
104
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
105
|
|
|
*/ |
106
|
|
|
protected $productDecimalAction; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* The action for product datetime attribute CRUD methods. |
110
|
|
|
* |
111
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
112
|
|
|
*/ |
113
|
|
|
protected $productDatetimeAction; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* The action for product website CRUD methods. |
117
|
|
|
* |
118
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
119
|
|
|
*/ |
120
|
|
|
protected $productWebsiteAction; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* The action for category product relation CRUD methods. |
124
|
|
|
* |
125
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
126
|
|
|
*/ |
127
|
|
|
protected $categoryProductAction; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* The action for stock item CRUD methods. |
131
|
|
|
* |
132
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
133
|
|
|
*/ |
134
|
|
|
protected $stockItemAction; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* The action for URL rewrite CRUD methods. |
138
|
|
|
* |
139
|
|
|
* @var \TechDivision\Import\Actions\ActionInterface |
140
|
|
|
*/ |
141
|
|
|
protected $urlRewriteAction; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* The repository to load the products with. |
145
|
|
|
* |
146
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductRepositoryInterface |
147
|
|
|
*/ |
148
|
|
|
protected $productRepository; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* The repository to load the product website relations with. |
152
|
|
|
* |
153
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductWebsiteRepositoryInterface |
154
|
|
|
*/ |
155
|
|
|
protected $productWebsiteRepository; |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* The repository to load the product datetime attribute with. |
159
|
|
|
* |
160
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductDatetimeRepositoryInterface |
161
|
|
|
*/ |
162
|
|
|
protected $productDatetimeRepository; |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* The repository to load the product decimal attribute with. |
166
|
|
|
* |
167
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductDecimalRepositoryInterface |
168
|
|
|
*/ |
169
|
|
|
protected $productDecimalRepository; |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* The repository to load the product integer attribute with. |
173
|
|
|
* |
174
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductIntRepositoryInterface |
175
|
|
|
*/ |
176
|
|
|
protected $productIntRepository; |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* The repository to load the product text attribute with. |
180
|
|
|
* |
181
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductTextRepositoryInterface |
182
|
|
|
*/ |
183
|
|
|
protected $productTextRepository; |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* The repository to load the product varchar attribute with. |
187
|
|
|
* |
188
|
|
|
* @var \TechDivision\Import\Product\Repositories\ProductVarcharRepositoryInterface |
189
|
|
|
*/ |
190
|
|
|
protected $productVarcharRepository; |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* The repository to load the category product relations with. |
194
|
|
|
* |
195
|
|
|
* @var \TechDivision\Import\Product\Repositories\CategoryProductRepositoryInterface |
196
|
|
|
*/ |
197
|
|
|
protected $categoryProductRepository; |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* The repository to load the stock item with. |
201
|
|
|
* |
202
|
|
|
* @var \TechDivision\Import\Product\Repositories\StockItemRepositoryInterface |
203
|
|
|
*/ |
204
|
|
|
protected $stockItemRepository; |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* The assembler to load the product attributes with. |
208
|
|
|
* |
209
|
|
|
* @var \TechDivision\Import\Product\Assemblers\ProductAttributeAssemblerInterface |
210
|
|
|
*/ |
211
|
|
|
protected $productAttributeAssembler; |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* Initialize the processor with the necessary assembler and repository instances. |
215
|
|
|
* |
216
|
|
|
* @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to use |
217
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductRepositoryInterface $productRepository The product repository to use |
218
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductWebsiteRepositoryInterface $productWebsiteRepository The product website repository to use |
219
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductDatetimeRepositoryInterface $productDatetimeRepository The product datetime repository to use |
220
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductDecimalRepositoryInterface $productDecimalRepository The product decimal repository to use |
221
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductIntRepositoryInterface $productIntRepository The product integer repository to use |
222
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductTextRepositoryInterface $productTextRepository The product text repository to use |
223
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductVarcharRepositoryInterface $productVarcharRepository The product varchar repository to use |
224
|
|
|
* @param \TechDivision\Import\Product\Repositories\CategoryProductRepositoryInterface $categoryProductRepository The category product repository to use |
225
|
|
|
* @param \TechDivision\Import\Product\Repositories\StockItemRepositoryInterface $stockItemRepository The stock item repository to use |
226
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The EAV attribute option value repository to use |
227
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The EAV attribute repository to use |
228
|
|
|
* @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The EAV entity type repository to use |
229
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $categoryProductAction The category product action to use |
230
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productDatetimeAction The product datetime action to use |
231
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productDecimalAction The product decimal action to use |
232
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productIntAction The product integer action to use |
233
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productAction The product action to use |
234
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productTextAction The product text action to use |
235
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productVarcharAction The product varchar action to use |
236
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $productWebsiteAction The product website action to use |
237
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $stockItemAction The stock item action to use |
238
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $urlRewriteAction The URL rewrite action to use |
239
|
|
|
* @param \TechDivision\Import\Product\Assemblers\ProductAttributeAssemblerInterface $productAttributeAssembler The assembler to load the product attributes with |
240
|
|
|
*/ |
241
|
|
|
public function __construct( |
242
|
|
|
ConnectionInterface $connection, |
243
|
|
|
ProductRepositoryInterface $productRepository, |
244
|
|
|
ProductWebsiteRepositoryInterface $productWebsiteRepository, |
245
|
|
|
ProductDatetimeRepositoryInterface $productDatetimeRepository, |
246
|
|
|
ProductDecimalRepositoryInterface $productDecimalRepository, |
247
|
|
|
ProductIntRepositoryInterface $productIntRepository, |
248
|
|
|
ProductTextRepositoryInterface $productTextRepository, |
249
|
|
|
ProductVarcharRepositoryInterface $productVarcharRepository, |
250
|
|
|
CategoryProductRepositoryInterface $categoryProductRepository, |
251
|
|
|
StockItemRepositoryInterface $stockItemRepository, |
252
|
|
|
EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository, |
253
|
|
|
EavAttributeRepositoryInterface $eavAttributeRepository, |
254
|
|
|
EavEntityTypeRepositoryInterface $eavEntityTypeRepository, |
255
|
|
|
ActionInterface $categoryProductAction, |
256
|
|
|
ActionInterface $productDatetimeAction, |
257
|
|
|
ActionInterface $productDecimalAction, |
258
|
|
|
ActionInterface $productIntAction, |
259
|
|
|
ActionInterface $productAction, |
260
|
|
|
ActionInterface $productTextAction, |
261
|
|
|
ActionInterface $productVarcharAction, |
262
|
|
|
ActionInterface $productWebsiteAction, |
263
|
|
|
ActionInterface $stockItemAction, |
264
|
|
|
ActionInterface $urlRewriteAction, |
265
|
|
|
ProductAttributeAssemblerInterface $productAttributeAssembler |
266
|
|
|
) { |
267
|
|
|
$this->setConnection($connection); |
268
|
|
|
$this->setProductRepository($productRepository); |
269
|
|
|
$this->setProductWebsiteRepository($productWebsiteRepository); |
270
|
|
|
$this->setProductDatetimeRepository($productDatetimeRepository); |
271
|
|
|
$this->setProductDecimalRepository($productDecimalRepository); |
272
|
|
|
$this->setProductIntRepository($productIntRepository); |
273
|
|
|
$this->setProductTextRepository($productTextRepository); |
274
|
|
|
$this->setProductVarcharRepository($productVarcharRepository); |
275
|
|
|
$this->setCategoryProductRepository($categoryProductRepository); |
276
|
|
|
$this->setStockItemRepository($stockItemRepository); |
277
|
|
|
$this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository); |
278
|
|
|
$this->setEavAttributeRepository($eavAttributeRepository); |
279
|
|
|
$this->setEavEntityTypeRepository($eavEntityTypeRepository); |
280
|
|
|
$this->setCategoryProductAction($categoryProductAction); |
281
|
|
|
$this->setProductDatetimeAction($productDatetimeAction); |
282
|
|
|
$this->setProductDecimalAction($productDecimalAction); |
283
|
|
|
$this->setProductIntAction($productIntAction); |
284
|
|
|
$this->setProductAction($productAction); |
285
|
|
|
$this->setProductTextAction($productTextAction); |
286
|
|
|
$this->setProductVarcharAction($productVarcharAction); |
287
|
|
|
$this->setProductWebsiteAction($productWebsiteAction); |
288
|
|
|
$this->setStockItemAction($stockItemAction); |
289
|
|
|
$this->setUrlRewriteAction($urlRewriteAction); |
290
|
|
|
$this->setProductAttributeAssembler($productAttributeAssembler); |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* Set's the passed connection. |
295
|
|
|
* |
296
|
|
|
* @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set |
297
|
|
|
* |
298
|
|
|
* @return void |
299
|
|
|
*/ |
300
|
|
|
public function setConnection(ConnectionInterface $connection) |
301
|
|
|
{ |
302
|
|
|
$this->connection = $connection; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* Return's the connection. |
307
|
|
|
* |
308
|
|
|
* @return \TechDivision\Import\Connection\ConnectionInterface The connection instance |
309
|
|
|
*/ |
310
|
|
|
public function getConnection() |
311
|
|
|
{ |
312
|
|
|
return $this->connection; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
317
|
|
|
* object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
318
|
|
|
* Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
319
|
|
|
* to autocommit mode. |
320
|
|
|
* |
321
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
322
|
|
|
* @link http://php.net/manual/en/pdo.begintransaction.php |
323
|
|
|
*/ |
324
|
|
|
public function beginTransaction() |
325
|
|
|
{ |
326
|
|
|
return $this->connection->beginTransaction(); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Commits a transaction, returning the database connection to autocommit mode until the next call to |
331
|
|
|
* ProductProcessor::beginTransaction() starts a new transaction. |
332
|
|
|
* |
333
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
334
|
|
|
* @link http://php.net/manual/en/pdo.commit.php |
335
|
|
|
*/ |
336
|
|
|
public function commit() |
337
|
|
|
{ |
338
|
|
|
return $this->connection->commit(); |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
343
|
|
|
* |
344
|
|
|
* If the database was set to autocommit mode, this function will restore autocommit mode after it has |
345
|
|
|
* rolled back the transaction. |
346
|
|
|
* |
347
|
|
|
* Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
348
|
|
|
* language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
349
|
|
|
* COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
350
|
|
|
* |
351
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
352
|
|
|
* @link http://php.net/manual/en/pdo.rollback.php |
353
|
|
|
*/ |
354
|
|
|
public function rollBack() |
355
|
|
|
{ |
356
|
|
|
return $this->connection->rollBack(); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* Set's the repository to access EAV attribute option values. |
361
|
|
|
* |
362
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option values |
363
|
|
|
* |
364
|
|
|
* @return void |
365
|
|
|
*/ |
366
|
|
|
public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository) |
367
|
|
|
{ |
368
|
|
|
$this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* Return's the repository to access EAV attribute option values. |
373
|
|
|
* |
374
|
|
|
* @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance |
375
|
|
|
*/ |
376
|
|
|
public function getEavAttributeOptionValueRepository() |
377
|
|
|
{ |
378
|
|
|
return $this->eavAttributeOptionValueRepository; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* Set's the repository to access EAV attributes. |
383
|
|
|
* |
384
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes |
385
|
|
|
* |
386
|
|
|
* @return void |
387
|
|
|
*/ |
388
|
|
|
public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository) |
389
|
|
|
{ |
390
|
|
|
$this->eavAttributeRepository = $eavAttributeRepository; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
/** |
394
|
|
|
* Return's the repository to access EAV attributes. |
395
|
|
|
* |
396
|
|
|
* @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance |
397
|
|
|
*/ |
398
|
|
|
public function getEavAttributeRepository() |
399
|
|
|
{ |
400
|
|
|
return $this->eavEntityTypeRepository; |
|
|
|
|
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* Set's the repository to access EAV entity types. |
405
|
|
|
* |
406
|
|
|
* @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The repository to access EAV entity types |
407
|
|
|
* |
408
|
|
|
* @return void |
409
|
|
|
*/ |
410
|
|
|
public function setEavEntityTypeRepository(EavEntityTypeRepositoryInterface $eavEntityTypeRepository) |
411
|
|
|
{ |
412
|
|
|
$this->eavEntityTypeRepository = $eavEntityTypeRepository; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* Return's the repository to access EAV entity types. |
417
|
|
|
* |
418
|
|
|
* @return \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface The repository instance |
419
|
|
|
*/ |
420
|
|
|
public function getEavEntityTypeRepository() |
421
|
|
|
{ |
422
|
|
|
return $this->eavEntityTypeRepository; |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Set's the action with the product CRUD methods. |
427
|
|
|
* |
428
|
|
|
* @param ActionInterface $productAction The action with the product CRUD methods |
429
|
|
|
* |
430
|
|
|
* @return void |
431
|
|
|
*/ |
432
|
|
|
public function setProductAction(ActionInterface $productAction) |
433
|
|
|
{ |
434
|
|
|
$this->productAction = $productAction; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Return's the action with the product CRUD methods. |
439
|
|
|
* |
440
|
|
|
* @return ActionInterface The action instance |
441
|
|
|
*/ |
442
|
|
|
public function getProductAction() |
443
|
|
|
{ |
444
|
|
|
return $this->productAction; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* Set's the action with the product varchar attribute CRUD methods. |
449
|
|
|
* |
450
|
|
|
* @param ActionInterface $productVarcharAction The action with the product varchar attriute CRUD methods |
451
|
|
|
* |
452
|
|
|
* @return void |
453
|
|
|
*/ |
454
|
|
|
public function setProductVarcharAction(ActionInterface $productVarcharAction) |
455
|
|
|
{ |
456
|
|
|
$this->productVarcharAction = $productVarcharAction; |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* Return's the action with the product varchar attribute CRUD methods. |
461
|
|
|
* |
462
|
|
|
* @return ActionInterface The action instance |
463
|
|
|
*/ |
464
|
|
|
public function getProductVarcharAction() |
465
|
|
|
{ |
466
|
|
|
return $this->productVarcharAction; |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* Set's the action with the product text attribute CRUD methods. |
471
|
|
|
* |
472
|
|
|
* @param ActionInterface $productTextAction The action with the product text attriute CRUD methods |
473
|
|
|
* |
474
|
|
|
* @return void |
475
|
|
|
*/ |
476
|
|
|
public function setProductTextAction(ActionInterface $productTextAction) |
477
|
|
|
{ |
478
|
|
|
$this->productTextAction = $productTextAction; |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* Return's the action with the product text attribute CRUD methods. |
483
|
|
|
* |
484
|
|
|
* @return ActionInterface The action instance |
485
|
|
|
*/ |
486
|
|
|
public function getProductTextAction() |
487
|
|
|
{ |
488
|
|
|
return $this->productTextAction; |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
/** |
492
|
|
|
* Set's the action with the product int attribute CRUD methods. |
493
|
|
|
* |
494
|
|
|
* @param ActionInterface $productIntAction The action with the product int attriute CRUD methods |
495
|
|
|
* |
496
|
|
|
* @return void |
497
|
|
|
*/ |
498
|
|
|
public function setProductIntAction(ActionInterface $productIntAction) |
499
|
|
|
{ |
500
|
|
|
$this->productIntAction = $productIntAction; |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* Return's the action with the product int attribute CRUD methods. |
505
|
|
|
* |
506
|
|
|
* @return ActionInterface The action instance |
507
|
|
|
*/ |
508
|
|
|
public function getProductIntAction() |
509
|
|
|
{ |
510
|
|
|
return $this->productIntAction; |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* Set's the action with the product decimal attribute CRUD methods. |
515
|
|
|
* |
516
|
|
|
* @param ActionInterface $productDecimalAction The action with the product decimal attriute CRUD methods |
517
|
|
|
* |
518
|
|
|
* @return void |
519
|
|
|
*/ |
520
|
|
|
public function setProductDecimalAction(ActionInterface $productDecimalAction) |
521
|
|
|
{ |
522
|
|
|
$this->productDecimalAction = $productDecimalAction; |
523
|
|
|
} |
524
|
|
|
|
525
|
|
|
/** |
526
|
|
|
* Return's the action with the product decimal attribute CRUD methods. |
527
|
|
|
* |
528
|
|
|
* @return ActionInterface The action instance |
529
|
|
|
*/ |
530
|
|
|
public function getProductDecimalAction() |
531
|
|
|
{ |
532
|
|
|
return $this->productDecimalAction; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* Set's the action with the product datetime attribute CRUD methods. |
537
|
|
|
* |
538
|
|
|
* @param ActionInterface $productDatetimeAction The action with the product datetime attriute CRUD methods |
539
|
|
|
* |
540
|
|
|
* @return void |
541
|
|
|
*/ |
542
|
|
|
public function setProductDatetimeAction(ActionInterface $productDatetimeAction) |
543
|
|
|
{ |
544
|
|
|
$this->productDatetimeAction = $productDatetimeAction; |
545
|
|
|
} |
546
|
|
|
|
547
|
|
|
/** |
548
|
|
|
* Return's the action with the product datetime attribute CRUD methods. |
549
|
|
|
* |
550
|
|
|
* @return ActionInterface The action instance |
551
|
|
|
*/ |
552
|
|
|
public function getProductDatetimeAction() |
553
|
|
|
{ |
554
|
|
|
return $this->productDatetimeAction; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* Set's the action with the product website CRUD methods. |
559
|
|
|
* |
560
|
|
|
* @param ActionInterface $productWebsiteAction The action with the product website CRUD methods |
561
|
|
|
* |
562
|
|
|
* @return void |
563
|
|
|
*/ |
564
|
|
|
public function setProductWebsiteAction(ActionInterface $productWebsiteAction) |
565
|
|
|
{ |
566
|
|
|
$this->productWebsiteAction = $productWebsiteAction; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* Return's the action with the product website CRUD methods. |
571
|
|
|
* |
572
|
|
|
* @return ActionInterface The action instance |
573
|
|
|
*/ |
574
|
|
|
public function getProductWebsiteAction() |
575
|
|
|
{ |
576
|
|
|
return $this->productWebsiteAction; |
577
|
|
|
} |
578
|
|
|
|
579
|
|
|
/** |
580
|
|
|
* Set's the action with the category product relation CRUD methods. |
581
|
|
|
* |
582
|
|
|
* @param ActionInterface $categoryProductAction The action with the category product relation CRUD methods |
583
|
|
|
* |
584
|
|
|
* @return void |
585
|
|
|
*/ |
586
|
|
|
public function setCategoryProductAction(ActionInterface $categoryProductAction) |
587
|
|
|
{ |
588
|
|
|
$this->categoryProductAction = $categoryProductAction; |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
/** |
592
|
|
|
* Return's the action with the category product relation CRUD methods. |
593
|
|
|
* |
594
|
|
|
* @return ActionInterface The action instance |
595
|
|
|
*/ |
596
|
|
|
public function getCategoryProductAction() |
597
|
|
|
{ |
598
|
|
|
return $this->categoryProductAction; |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
/** |
602
|
|
|
* Set's the action with the stock item CRUD methods. |
603
|
|
|
* |
604
|
|
|
* @param ActionInterface $stockItemAction The action with the stock item CRUD methods |
605
|
|
|
* |
606
|
|
|
* @return void |
607
|
|
|
*/ |
608
|
|
|
public function setStockItemAction(ActionInterface $stockItemAction) |
609
|
|
|
{ |
610
|
|
|
$this->stockItemAction = $stockItemAction; |
611
|
|
|
} |
612
|
|
|
|
613
|
|
|
/** |
614
|
|
|
* Return's the action with the stock item CRUD methods. |
615
|
|
|
* |
616
|
|
|
* @return ActionInterface The action instance |
617
|
|
|
*/ |
618
|
|
|
public function getStockItemAction() |
619
|
|
|
{ |
620
|
|
|
return $this->stockItemAction; |
621
|
|
|
} |
622
|
|
|
|
623
|
|
|
/** |
624
|
|
|
* Set's the action with the URL rewrite CRUD methods. |
625
|
|
|
* |
626
|
|
|
* @param \TechDivision\Import\Actions\ActionInterface $urlRewriteAction The action with the URL rewrite CRUD methods |
627
|
|
|
* |
628
|
|
|
* @return void |
629
|
|
|
*/ |
630
|
|
|
public function setUrlRewriteAction(ActionInterface $urlRewriteAction) |
631
|
|
|
{ |
632
|
|
|
$this->urlRewriteAction = $urlRewriteAction; |
633
|
|
|
} |
634
|
|
|
|
635
|
|
|
/** |
636
|
|
|
* Return's the action with the URL rewrite CRUD methods. |
637
|
|
|
* |
638
|
|
|
* @return \TechDivision\Import\Actions\ActionInterface The action instance |
639
|
|
|
*/ |
640
|
|
|
public function getUrlRewriteAction() |
641
|
|
|
{ |
642
|
|
|
return $this->urlRewriteAction; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
/** |
646
|
|
|
* Set's the repository to load the products with. |
647
|
|
|
* |
648
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductRepositoryInterface $productRepository The repository instance |
649
|
|
|
* |
650
|
|
|
* @return void |
651
|
|
|
*/ |
652
|
|
|
public function setProductRepository(ProductRepositoryInterface $productRepository) |
653
|
|
|
{ |
654
|
|
|
$this->productRepository = $productRepository; |
655
|
|
|
} |
656
|
|
|
|
657
|
|
|
/** |
658
|
|
|
* Return's the repository to load the products with. |
659
|
|
|
* |
660
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductRepositoryInterface The repository instance |
661
|
|
|
*/ |
662
|
|
|
public function getProductRepository() |
663
|
|
|
{ |
664
|
|
|
return $this->productRepository; |
665
|
|
|
} |
666
|
|
|
|
667
|
|
|
/** |
668
|
|
|
* Set's the repository to load the product website relations with. |
669
|
|
|
* |
670
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductWebsiteRepositoryInterface $productWebsiteRepository The repository instance |
671
|
|
|
* |
672
|
|
|
* @return void |
673
|
|
|
*/ |
674
|
|
|
public function setProductWebsiteRepository(ProductWebsiteRepositoryInterface $productWebsiteRepository) |
675
|
|
|
{ |
676
|
|
|
$this->productWebsiteRepository = $productWebsiteRepository; |
677
|
|
|
} |
678
|
|
|
|
679
|
|
|
/** |
680
|
|
|
* Return's the repository to load the product website relations with. |
681
|
|
|
* |
682
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductWebsiteRepositoryInterface The repository instance |
683
|
|
|
*/ |
684
|
|
|
public function getProductWebsiteRepository() |
685
|
|
|
{ |
686
|
|
|
return $this->productWebsiteRepository; |
687
|
|
|
} |
688
|
|
|
|
689
|
|
|
/** |
690
|
|
|
* Set's the repository to load the product datetime attribute with. |
691
|
|
|
* |
692
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductDatetimeRepositoryInterface $productDatetimeRepository The repository instance |
693
|
|
|
* |
694
|
|
|
* @return void |
695
|
|
|
*/ |
696
|
|
|
public function setProductDatetimeRepository(ProductDatetimeRepositoryInterface $productDatetimeRepository) |
697
|
|
|
{ |
698
|
|
|
$this->productDatetimeRepository = $productDatetimeRepository; |
699
|
|
|
} |
700
|
|
|
|
701
|
|
|
/** |
702
|
|
|
* Return's the repository to load the product datetime attribute with. |
703
|
|
|
* |
704
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductDatetimeRepositoryInterface The repository instance |
705
|
|
|
*/ |
706
|
|
|
public function getProductDatetimeRepository() |
707
|
|
|
{ |
708
|
|
|
return $this->productDatetimeRepository; |
709
|
|
|
} |
710
|
|
|
|
711
|
|
|
/** |
712
|
|
|
* Set's the repository to load the product decimal attribute with. |
713
|
|
|
* |
714
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductDecimalRepositoryInterface $productDecimalRepository The repository instance |
715
|
|
|
* |
716
|
|
|
* @return void |
717
|
|
|
*/ |
718
|
|
|
public function setProductDecimalRepository(ProductDecimalRepositoryInterface $productDecimalRepository) |
719
|
|
|
{ |
720
|
|
|
$this->productDecimalRepository = $productDecimalRepository; |
721
|
|
|
} |
722
|
|
|
|
723
|
|
|
/** |
724
|
|
|
* Return's the repository to load the product decimal attribute with. |
725
|
|
|
* |
726
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductDecimalRepositoryInterface The repository instance |
727
|
|
|
*/ |
728
|
|
|
public function getProductDecimalRepository() |
729
|
|
|
{ |
730
|
|
|
return $this->productDecimalRepository; |
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* Set's the repository to load the product integer attribute with. |
735
|
|
|
* |
736
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductIntRepositoryInterface $productIntRepository The repository instance |
737
|
|
|
* |
738
|
|
|
* @return void |
739
|
|
|
*/ |
740
|
|
|
public function setProductIntRepository(ProductIntRepositoryInterface $productIntRepository) |
741
|
|
|
{ |
742
|
|
|
$this->productIntRepository = $productIntRepository; |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
/** |
746
|
|
|
* Return's the repository to load the product integer attribute with. |
747
|
|
|
* |
748
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductIntRepositoryInterface The repository instance |
749
|
|
|
*/ |
750
|
|
|
public function getProductIntRepository() |
751
|
|
|
{ |
752
|
|
|
return $this->productIntRepository; |
753
|
|
|
} |
754
|
|
|
|
755
|
|
|
/** |
756
|
|
|
* Set's the repository to load the product text attribute with. |
757
|
|
|
* |
758
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductTextRepositoryInterface $productTextRepository The repository instance |
759
|
|
|
* |
760
|
|
|
* @return void |
761
|
|
|
*/ |
762
|
|
|
public function setProductTextRepository(ProductTextRepositoryInterface $productTextRepository) |
763
|
|
|
{ |
764
|
|
|
$this->productTextRepository = $productTextRepository; |
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
/** |
768
|
|
|
* Return's the repository to load the product text attribute with. |
769
|
|
|
* |
770
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductTextRepositoryInterface The repository instance |
771
|
|
|
*/ |
772
|
|
|
public function getProductTextRepository() |
773
|
|
|
{ |
774
|
|
|
return $this->productTextRepository; |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
/** |
778
|
|
|
* Set's the repository to load the product varchar attribute with. |
779
|
|
|
* |
780
|
|
|
* @param \TechDivision\Import\Product\Repositories\ProductVarcharRepositoryInterface $productVarcharRepository The repository instance |
781
|
|
|
* |
782
|
|
|
* @return void |
783
|
|
|
*/ |
784
|
|
|
public function setProductVarcharRepository(ProductVarcharRepositoryInterface $productVarcharRepository) |
785
|
|
|
{ |
786
|
|
|
$this->productVarcharRepository = $productVarcharRepository; |
787
|
|
|
} |
788
|
|
|
|
789
|
|
|
/** |
790
|
|
|
* Return's the repository to load the product varchar attribute with. |
791
|
|
|
* |
792
|
|
|
* @return \TechDivision\Import\Product\Repositories\ProductVarcharRepositoryInterface The repository instance |
793
|
|
|
*/ |
794
|
|
|
public function getProductVarcharRepository() |
795
|
|
|
{ |
796
|
|
|
return $this->productVarcharRepository; |
797
|
|
|
} |
798
|
|
|
|
799
|
|
|
/** |
800
|
|
|
* Set's the repository to load the category product relations with. |
801
|
|
|
* |
802
|
|
|
* @param \TechDivision\Import\Product\Repositories\CategoryProductRepositoryInterface $categoryProductRepository The repository instance |
803
|
|
|
* |
804
|
|
|
* @return void |
805
|
|
|
*/ |
806
|
|
|
public function setCategoryProductRepository(CategoryProductRepositoryInterface $categoryProductRepository) |
807
|
|
|
{ |
808
|
|
|
$this->categoryProductRepository = $categoryProductRepository; |
809
|
|
|
} |
810
|
|
|
|
811
|
|
|
/** |
812
|
|
|
* Return's the repository to load the category product relations with. |
813
|
|
|
* |
814
|
|
|
* @return \TechDivision\Import\Product\Repositories\CategoryProductRepositoryInterface The repository instance |
815
|
|
|
*/ |
816
|
|
|
public function getCategoryProductRepository() |
817
|
|
|
{ |
818
|
|
|
return $this->categoryProductRepository; |
819
|
|
|
} |
820
|
|
|
|
821
|
|
|
/** |
822
|
|
|
* Set's the repository to load the stock items with. |
823
|
|
|
* |
824
|
|
|
* @param \TechDivision\Import\Product\Repositories\StockItemRepositoryInterface $stockItemRepository The repository instance |
825
|
|
|
* |
826
|
|
|
* @return void |
827
|
|
|
*/ |
828
|
|
|
public function setStockItemRepository(StockItemRepositoryInterface $stockItemRepository) |
829
|
|
|
{ |
830
|
|
|
$this->stockItemRepository = $stockItemRepository; |
831
|
|
|
} |
832
|
|
|
|
833
|
|
|
/** |
834
|
|
|
* Return's the repository to load the stock items with. |
835
|
|
|
* |
836
|
|
|
* @return \TechDivision\Import\Product\Repositories\StockItemRepositoryInterface The repository instance |
837
|
|
|
*/ |
838
|
|
|
public function getStockItemRepository() |
839
|
|
|
{ |
840
|
|
|
return $this->stockItemRepository; |
841
|
|
|
} |
842
|
|
|
|
843
|
|
|
/** |
844
|
|
|
* Set's the assembler to load the product attributes with. |
845
|
|
|
* |
846
|
|
|
* @param \TechDivision\Import\Product\Assemblers\ProductAttributeAssemblerInterface $productAttributeAssembler The assembler instance |
847
|
|
|
* |
848
|
|
|
* @return void |
849
|
|
|
*/ |
850
|
|
|
public function setProductAttributeAssembler(ProductAttributeAssemblerInterface $productAttributeAssembler) |
851
|
|
|
{ |
852
|
|
|
$this->productAttributeAssembler = $productAttributeAssembler; |
853
|
|
|
} |
854
|
|
|
|
855
|
|
|
/** |
856
|
|
|
* Return's the assembler to load the product attributes with. |
857
|
|
|
* |
858
|
|
|
* @return \TechDivision\Import\Product\Assemblers\ProductAttributeAssemblerInterface The assembler instance |
859
|
|
|
*/ |
860
|
|
|
public function getProductAttributeAssembler() |
861
|
|
|
{ |
862
|
|
|
return $this->productAttributeAssembler; |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
/** |
866
|
|
|
* Return's an array with the available EAV attributes for the passed is user defined flag. |
867
|
|
|
* |
868
|
|
|
* @param integer $isUserDefined The flag itself |
869
|
|
|
* |
870
|
|
|
* @return array The array with the EAV attributes matching the passed flag |
871
|
|
|
*/ |
872
|
|
|
public function getEavAttributeByIsUserDefined($isUserDefined = 1) |
873
|
|
|
{ |
874
|
|
|
return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined); |
875
|
|
|
} |
876
|
|
|
|
877
|
|
|
/** |
878
|
|
|
* Return's the category product relations for the product with the passed SKU. |
879
|
|
|
* |
880
|
|
|
* @param string $sku The product SKU to load the category relations for |
881
|
|
|
* |
882
|
|
|
* @return array The category product relations for the product with the passed SKU |
883
|
|
|
*/ |
884
|
|
|
public function getCategoryProductsBySku($sku) |
885
|
|
|
{ |
886
|
|
|
return $this->getCategoryProductRepository()->findAllBySku($sku); |
887
|
|
|
} |
888
|
|
|
|
889
|
|
|
/** |
890
|
|
|
* Intializes the existing attributes for the entity with the passed primary key. |
891
|
|
|
* |
892
|
|
|
* @param string $pk The primary key of the entity to load the attributes for |
893
|
|
|
* @param integer $storeId The ID of the store view to load the attributes for |
894
|
|
|
* |
895
|
|
|
* @return array The entity attributes |
896
|
|
|
*/ |
897
|
|
|
public function getProductAttributesByPrimaryKeyAndStoreId($pk, $storeId) |
898
|
|
|
{ |
899
|
|
|
return $this->getProductAttributeAssembler()->getProductAttributesByPrimaryKeyAndStoreId($pk, $storeId); |
900
|
|
|
} |
901
|
|
|
|
902
|
|
|
/** |
903
|
|
|
* Load's and return's the EAV attribute option value with the passed code, store ID and value. |
904
|
|
|
* |
905
|
|
|
* @param string $attributeCode The code of the EAV attribute option to load |
906
|
|
|
* @param integer $storeId The store ID of the attribute option to load |
907
|
|
|
* @param string $value The value of the attribute option to load |
908
|
|
|
* |
909
|
|
|
* @return array The EAV attribute option value |
910
|
|
|
* @deprecated Since 5.0.0 |
911
|
|
|
* @see \TechDivision\Import\Services\EavAwareProcessorInterface::loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue() |
912
|
|
|
*/ |
913
|
|
|
public function loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value) |
914
|
|
|
{ |
915
|
|
|
return $this->getEavAttributeOptionValueRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value); |
|
|
|
|
916
|
|
|
} |
917
|
|
|
|
918
|
|
|
/** |
919
|
|
|
* Load's and return's the EAV attribute option value with the passed entity type ID, code, store ID and value. |
920
|
|
|
* |
921
|
|
|
* @param string $entityTypeId The entity type ID of the EAV attribute to load the option value for |
922
|
|
|
* @param string $attributeCode The code of the EAV attribute option to load |
923
|
|
|
* @param integer $storeId The store ID of the attribute option to load |
924
|
|
|
* @param string $value The value of the attribute option to load |
925
|
|
|
* |
926
|
|
|
* @return array The EAV attribute option value |
927
|
|
|
*/ |
928
|
|
|
public function loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value) |
929
|
|
|
{ |
930
|
|
|
return $this->getEavAttributeOptionValueRepository()->findOneByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value); |
931
|
|
|
} |
932
|
|
|
|
933
|
|
|
/** |
934
|
|
|
* Load's and return's the product with the passed SKU. |
935
|
|
|
* |
936
|
|
|
* @param string $sku The SKU of the product to load |
937
|
|
|
* |
938
|
|
|
* @return array The product |
939
|
|
|
*/ |
940
|
|
|
public function loadProduct($sku) |
941
|
|
|
{ |
942
|
|
|
return $this->getProductRepository()->findOneBySku($sku); |
943
|
|
|
} |
944
|
|
|
|
945
|
|
|
/** |
946
|
|
|
* Load's and return's the product website relation with the passed product and website ID. |
947
|
|
|
* |
948
|
|
|
* @param string $productId The product ID of the relation |
949
|
|
|
* @param string $websiteId The website ID of the relation |
950
|
|
|
* |
951
|
|
|
* @return array The product website |
952
|
|
|
*/ |
953
|
|
|
public function loadProductWebsite($productId, $websiteId) |
954
|
|
|
{ |
955
|
|
|
return $this->getProductWebsiteRepository()->findOneByProductIdAndWebsite($productId, $websiteId); |
956
|
|
|
} |
957
|
|
|
|
958
|
|
|
/** |
959
|
|
|
* Load's and return's the product website relations for the product with the passed SKU. |
960
|
|
|
* |
961
|
|
|
* @param string $sku The SKU to of the product to load the product website relations for |
962
|
|
|
* |
963
|
|
|
* @return array The product website relations |
964
|
|
|
*/ |
965
|
|
|
public function loadProductWebsitesBySku($sku) |
966
|
|
|
{ |
967
|
|
|
return $this->getProductWebsiteRepository()->findAllBySku($sku); |
968
|
|
|
} |
969
|
|
|
|
970
|
|
|
/** |
971
|
|
|
* Return's the category product relation with the passed category/product ID. |
972
|
|
|
* |
973
|
|
|
* @param integer $categoryId The category ID of the category product relation to return |
974
|
|
|
* @param integer $productId The product ID of the category product relation to return |
975
|
|
|
* |
976
|
|
|
* @return array The category product relation |
977
|
|
|
*/ |
978
|
|
|
public function loadCategoryProduct($categoryId, $productId) |
979
|
|
|
{ |
980
|
|
|
return $this->getCategoryProductRepository()->findOneByCategoryIdAndProductId($categoryId, $productId); |
981
|
|
|
} |
982
|
|
|
|
983
|
|
|
/** |
984
|
|
|
* Load's and return's the stock status with the passed product/website/stock ID. |
985
|
|
|
* |
986
|
|
|
* @param integer $productId The product ID of the stock item to load |
987
|
|
|
* @param integer $websiteId The website ID of the stock item to load |
988
|
|
|
* @param integer $stockId The stock ID of the stock item to load |
989
|
|
|
* |
990
|
|
|
* @return array The stock item |
991
|
|
|
*/ |
992
|
|
|
public function loadStockItem($productId, $websiteId, $stockId) |
993
|
|
|
{ |
994
|
|
|
return $this->getStockItemRepository()->findOneByProductIdAndWebsiteIdAndStockId($productId, $websiteId, $stockId); |
995
|
|
|
} |
996
|
|
|
|
997
|
|
|
/** |
998
|
|
|
* Load's and return's the varchar attribute with the passed params. |
999
|
|
|
* |
1000
|
|
|
* @param integer $attributeCode The attribute code of the varchar attribute |
1001
|
|
|
* @param integer $entityTypeId The entity type ID of the varchar attribute |
1002
|
|
|
* @param integer $storeId The store ID of the varchar attribute |
1003
|
|
|
* @param string $value The value of the varchar attribute |
1004
|
|
|
* |
1005
|
|
|
* @return array|null The varchar attribute |
1006
|
|
|
*/ |
1007
|
|
|
public function loadProductVarcharAttributeByAttributeCodeAndEntityTypeIdAndStoreIdAndValue($attributeCode, $entityTypeId, $storeId, $value) |
1008
|
|
|
{ |
1009
|
|
|
return $this->getProductVarcharRepository()->findOneByAttributeCodeAndEntityTypeIdAndStoreIdAndValue($attributeCode, $entityTypeId, $storeId, $value); |
1010
|
|
|
} |
1011
|
|
|
|
1012
|
|
|
/** |
1013
|
|
|
* Return's an EAV entity type with the passed entity type code. |
1014
|
|
|
* |
1015
|
|
|
* @param string $entityTypeCode The code of the entity type to return |
1016
|
|
|
* |
1017
|
|
|
* @return array The entity type with the passed entity type code |
1018
|
|
|
*/ |
1019
|
|
|
public function loadEavEntityTypeByEntityTypeCode($entityTypeCode) |
1020
|
|
|
{ |
1021
|
|
|
return $this->getEavEntityTypeRepository()->findOneByEntityTypeCode($entityTypeCode); |
1022
|
|
|
} |
1023
|
|
|
|
1024
|
|
|
/** |
1025
|
|
|
* Persist's the passed product data and return's the ID. |
1026
|
|
|
* |
1027
|
|
|
* @param array $product The product data to persist |
1028
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1029
|
|
|
* |
1030
|
|
|
* @return string The ID of the persisted entity |
1031
|
|
|
*/ |
1032
|
|
View Code Duplication |
public function persistProduct($product, $name = null) |
|
|
|
|
1033
|
|
|
{ |
1034
|
|
|
|
1035
|
|
|
// persist the new entity and set the PK value in the entity |
1036
|
|
|
$product[$pkName = $this->getProductRepository()->getPrimaryKeyName()] = $this->getProductAction()->persist($product, $name); |
|
|
|
|
1037
|
|
|
|
1038
|
|
|
// load the cache adapter instance |
1039
|
|
|
$cacheAdapter = $this->getProductRepository()->getCacheAdapter(); |
1040
|
|
|
|
1041
|
|
|
// we only want to replace existing values, NOT adding new ones as this is the responsibility of the repository |
1042
|
|
|
if ($cacheAdapter->isCached($uniqueKey = array(CacheKeys::PRODUCT => $product[$pkName]))) { |
|
|
|
|
1043
|
|
|
// add the entity value to the cache, register the cache key reference as well |
1044
|
|
|
$cacheAdapter->toCache($uniqueKey, $product, array(), array(), true); |
|
|
|
|
1045
|
|
|
} |
1046
|
|
|
|
1047
|
|
|
// return the ID of the persisted entity |
1048
|
|
|
return $product[$pkName]; |
1049
|
|
|
} |
1050
|
|
|
|
1051
|
|
|
/** |
1052
|
|
|
* Persist's the passed product varchar attribute. |
1053
|
|
|
* |
1054
|
|
|
* @param array $attribute The attribute to persist |
1055
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1056
|
|
|
* |
1057
|
|
|
* @return string The ID of the persisted attribute |
1058
|
|
|
*/ |
1059
|
|
View Code Duplication |
public function persistProductVarcharAttribute($attribute, $name = null) |
|
|
|
|
1060
|
|
|
{ |
1061
|
|
|
|
1062
|
|
|
// persist the new entity and set the PK value in the entity |
1063
|
|
|
$attribute[$pkName = $this->getProductVarcharRepository()->getPrimaryKeyName()] = $this->getProductVarcharAction()->persist($attribute, $name); |
|
|
|
|
1064
|
|
|
|
1065
|
|
|
// load the cache adapter instance |
1066
|
|
|
$cacheAdapter = $this->getProductVarcharRepository()->getCacheAdapter(); |
1067
|
|
|
|
1068
|
|
|
// we only want to replace existing values, NOT adding new ones as this is the responsibility of the repository |
1069
|
|
|
if ($cacheAdapter->isCached($uniqueKey = array(CacheKeys::PRODUCT_VARCHAR => $attribute[$pkName]))) { |
1070
|
|
|
// add the attribute value to the cache, register the cache key reference as well |
1071
|
|
|
$cacheAdapter->toCache($uniqueKey, $attribute, array(), array(), true); |
1072
|
|
|
} |
1073
|
|
|
|
1074
|
|
|
// return the ID of the persisted attribute |
1075
|
|
|
return $attribute[$pkName]; |
1076
|
|
|
} |
1077
|
|
|
|
1078
|
|
|
/** |
1079
|
|
|
* Persist's the passed product integer attribute. |
1080
|
|
|
* |
1081
|
|
|
* @param array $attribute The attribute to persist |
1082
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1083
|
|
|
* |
1084
|
|
|
* @return void |
1085
|
|
|
*/ |
1086
|
|
|
public function persistProductIntAttribute($attribute, $name = null) |
1087
|
|
|
{ |
1088
|
|
|
$this->getProductIntAction()->persist($attribute, $name); |
|
|
|
|
1089
|
|
|
} |
1090
|
|
|
|
1091
|
|
|
/** |
1092
|
|
|
* Persist's the passed product decimal attribute. |
1093
|
|
|
* |
1094
|
|
|
* @param array $attribute The attribute to persist |
1095
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1096
|
|
|
* |
1097
|
|
|
* @return void |
1098
|
|
|
*/ |
1099
|
|
|
public function persistProductDecimalAttribute($attribute, $name = null) |
1100
|
|
|
{ |
1101
|
|
|
$this->getProductDecimalAction()->persist($attribute, $name); |
|
|
|
|
1102
|
|
|
} |
1103
|
|
|
|
1104
|
|
|
/** |
1105
|
|
|
* Persist's the passed product datetime attribute. |
1106
|
|
|
* |
1107
|
|
|
* @param array $attribute The attribute to persist |
1108
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1109
|
|
|
* |
1110
|
|
|
* @return void |
1111
|
|
|
*/ |
1112
|
|
|
public function persistProductDatetimeAttribute($attribute, $name = null) |
1113
|
|
|
{ |
1114
|
|
|
$this->getProductDatetimeAction()->persist($attribute, $name); |
|
|
|
|
1115
|
|
|
} |
1116
|
|
|
|
1117
|
|
|
/** |
1118
|
|
|
* Persist's the passed product text attribute. |
1119
|
|
|
* |
1120
|
|
|
* @param array $attribute The attribute to persist |
1121
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1122
|
|
|
* |
1123
|
|
|
* @return void |
1124
|
|
|
*/ |
1125
|
|
|
public function persistProductTextAttribute($attribute, $name = null) |
1126
|
|
|
{ |
1127
|
|
|
$this->getProductTextAction()->persist($attribute, $name); |
|
|
|
|
1128
|
|
|
} |
1129
|
|
|
|
1130
|
|
|
/** |
1131
|
|
|
* Persist's the passed product website data and return's the ID. |
1132
|
|
|
* |
1133
|
|
|
* @param array $productWebsite The product website data to persist |
1134
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1135
|
|
|
* |
1136
|
|
|
* @return void |
1137
|
|
|
*/ |
1138
|
|
|
public function persistProductWebsite($productWebsite, $name = null) |
1139
|
|
|
{ |
1140
|
|
|
$this->getProductWebsiteAction()->persist($productWebsite, $name); |
|
|
|
|
1141
|
|
|
} |
1142
|
|
|
|
1143
|
|
|
/** |
1144
|
|
|
* Persist's the passed category product relation. |
1145
|
|
|
* |
1146
|
|
|
* @param array $categoryProduct The category product relation to persist |
1147
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1148
|
|
|
* |
1149
|
|
|
* @return void |
1150
|
|
|
*/ |
1151
|
|
|
public function persistCategoryProduct($categoryProduct, $name = null) |
1152
|
|
|
{ |
1153
|
|
|
$this->getCategoryProductAction()->persist($categoryProduct, $name); |
|
|
|
|
1154
|
|
|
} |
1155
|
|
|
|
1156
|
|
|
/** |
1157
|
|
|
* Persist's the passed stock item data and return's the ID. |
1158
|
|
|
* |
1159
|
|
|
* @param array $stockItem The stock item data to persist |
1160
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1161
|
|
|
* |
1162
|
|
|
* @return void |
1163
|
|
|
*/ |
1164
|
|
|
public function persistStockItem($stockItem, $name = null) |
1165
|
|
|
{ |
1166
|
|
|
$this->getStockItemAction()->persist($stockItem, $name); |
|
|
|
|
1167
|
|
|
} |
1168
|
|
|
|
1169
|
|
|
/** |
1170
|
|
|
* Delete's the entity with the passed attributes. |
1171
|
|
|
* |
1172
|
|
|
* @param array $row The attributes of the entity to delete |
1173
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1174
|
|
|
* |
1175
|
|
|
* @return void |
1176
|
|
|
*/ |
1177
|
|
|
public function deleteProduct($row, $name = null) |
1178
|
|
|
{ |
1179
|
|
|
$this->getProductAction()->delete($row, $name); |
1180
|
|
|
} |
1181
|
|
|
|
1182
|
|
|
/** |
1183
|
|
|
* Delete's the URL rewrite with the passed attributes. |
1184
|
|
|
* |
1185
|
|
|
* @param array $row The attributes of the entity to delete |
1186
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1187
|
|
|
* |
1188
|
|
|
* @return void |
1189
|
|
|
*/ |
1190
|
|
|
public function deleteUrlRewrite($row, $name = null) |
1191
|
|
|
{ |
1192
|
|
|
$this->getUrlRewriteAction()->delete($row, $name); |
1193
|
|
|
} |
1194
|
|
|
|
1195
|
|
|
/** |
1196
|
|
|
* Delete's the stock item(s) with the passed attributes. |
1197
|
|
|
* |
1198
|
|
|
* @param array $row The attributes of the entity to delete |
1199
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1200
|
|
|
* |
1201
|
|
|
* @return void |
1202
|
|
|
*/ |
1203
|
|
|
public function deleteStockItem($row, $name = null) |
1204
|
|
|
{ |
1205
|
|
|
$this->getStockItemAction()->delete($row, $name); |
1206
|
|
|
} |
1207
|
|
|
|
1208
|
|
|
/** |
1209
|
|
|
* Delete's the product website relations with the passed attributes. |
1210
|
|
|
* |
1211
|
|
|
* @param array $row The attributes of the entity to delete |
1212
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1213
|
|
|
* |
1214
|
|
|
* @return void |
1215
|
|
|
*/ |
1216
|
|
|
public function deleteProductWebsite($row, $name = null) |
1217
|
|
|
{ |
1218
|
|
|
$this->getProductWebsiteAction()->delete($row, $name); |
1219
|
|
|
} |
1220
|
|
|
|
1221
|
|
|
/** |
1222
|
|
|
* Delete's the category product relations with the passed attributes. |
1223
|
|
|
* |
1224
|
|
|
* @param array $row The attributes of the entity to delete |
1225
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1226
|
|
|
* |
1227
|
|
|
* @return void |
1228
|
|
|
*/ |
1229
|
|
|
public function deleteCategoryProduct($row, $name = null) |
1230
|
|
|
{ |
1231
|
|
|
$this->getCategoryProductAction()->delete($row, $name); |
1232
|
|
|
} |
1233
|
|
|
|
1234
|
|
|
/** |
1235
|
|
|
* Delete's the product datetime attribute with the passed attributes. |
1236
|
|
|
* |
1237
|
|
|
* @param array $row The attributes of the entity to delete |
1238
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1239
|
|
|
* |
1240
|
|
|
* @return void |
1241
|
|
|
*/ |
1242
|
|
|
public function deleteProductDatetimeAttribute($row, $name = null) |
1243
|
|
|
{ |
1244
|
|
|
$this->getProductDatetimeAction()->delete($row, $name); |
1245
|
|
|
} |
1246
|
|
|
|
1247
|
|
|
/** |
1248
|
|
|
* Delete's the product decimal attribute with the passed attributes. |
1249
|
|
|
* |
1250
|
|
|
* @param array $row The attributes of the entity to delete |
1251
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1252
|
|
|
* |
1253
|
|
|
* @return void |
1254
|
|
|
*/ |
1255
|
|
|
public function deleteProductDecimalAttribute($row, $name = null) |
1256
|
|
|
{ |
1257
|
|
|
$this->getProductDecimalAction()->delete($row, $name); |
1258
|
|
|
} |
1259
|
|
|
|
1260
|
|
|
/** |
1261
|
|
|
* Delete's the product integer attribute with the passed attributes. |
1262
|
|
|
* |
1263
|
|
|
* @param array $row The attributes of the entity to delete |
1264
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1265
|
|
|
* |
1266
|
|
|
* @return void |
1267
|
|
|
*/ |
1268
|
|
|
public function deleteProductIntAttribute($row, $name = null) |
1269
|
|
|
{ |
1270
|
|
|
$this->getProductIntAction()->delete($row, $name); |
1271
|
|
|
} |
1272
|
|
|
|
1273
|
|
|
/** |
1274
|
|
|
* Delete's the product text attribute with the passed attributes. |
1275
|
|
|
* |
1276
|
|
|
* @param array $row The attributes of the entity to delete |
1277
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1278
|
|
|
* |
1279
|
|
|
* @return void |
1280
|
|
|
*/ |
1281
|
|
|
public function deleteProductTextAttribute($row, $name = null) |
1282
|
|
|
{ |
1283
|
|
|
$this->getProductTextAction()->delete($row, $name); |
1284
|
|
|
} |
1285
|
|
|
|
1286
|
|
|
/** |
1287
|
|
|
* Delete's the product varchar attribute with the passed attributes. |
1288
|
|
|
* |
1289
|
|
|
* @param array $row The attributes of the entity to delete |
1290
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
1291
|
|
|
* |
1292
|
|
|
* @return void |
1293
|
|
|
*/ |
1294
|
|
|
public function deleteProductVarcharAttribute($row, $name = null) |
1295
|
|
|
{ |
1296
|
|
|
$this->getProductVarcharAction()->delete($row, $name); |
1297
|
|
|
} |
1298
|
|
|
|
1299
|
|
|
/** |
1300
|
|
|
* Clean-Up the repositories to free memory. |
1301
|
|
|
* |
1302
|
|
|
* @return void |
1303
|
|
|
*/ |
1304
|
|
|
public function cleanUp() |
1305
|
|
|
{ |
1306
|
|
|
} |
1307
|
|
|
} |
1308
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: