1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Attribute\Services\AttributeBunchProcessor |
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-attribute |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Attribute\Services; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Connection\ConnectionInterface; |
24
|
|
|
use TechDivision\Import\Repositories\EavAttributeOptionValueRepository; |
25
|
|
|
use TechDivision\Import\Attribute\Actions\AttributeAction; |
26
|
|
|
use TechDivision\Import\Attribute\Actions\AttributeLabelAction; |
27
|
|
|
use TechDivision\Import\Attribute\Actions\AttributeOptionAction; |
28
|
|
|
use TechDivision\Import\Attribute\Actions\AttributeOptionValueAction; |
29
|
|
|
use TechDivision\Import\Attribute\Actions\AttributeOptionSwatchAction; |
30
|
|
|
use TechDivision\Import\Attribute\Actions\CatalogAttributeAction; |
31
|
|
|
use TechDivision\Import\Attribute\Actions\EntityAttributeAction; |
32
|
|
|
use TechDivision\Import\Attribute\Repositories\AttributeRepository; |
33
|
|
|
use TechDivision\Import\Attribute\Repositories\AttributeLabelRepository; |
34
|
|
|
use TechDivision\Import\Attribute\Repositories\AttributeOptionRepository; |
35
|
|
|
use TechDivision\Import\Attribute\Repositories\AttributeOptionSwatchRepository; |
36
|
|
|
use TechDivision\Import\Attribute\Repositories\CatalogAttributeRepository; |
37
|
|
|
use TechDivision\Import\Attribute\Repositories\EntityAttributeRepository; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* The attribute bunch processor implementation. |
41
|
|
|
* |
42
|
|
|
* @author Tim Wagner <[email protected]> |
43
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
44
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
45
|
|
|
* @link https://github.com/techdivision/import-attribute |
46
|
|
|
* @link http://www.techdivision.com |
47
|
|
|
*/ |
48
|
|
|
class AttributeBunchProcessor implements AttributeBunchProcessorInterface |
49
|
|
|
{ |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* A connection to use. |
53
|
|
|
* |
54
|
|
|
* @var \TechDivision\Import\Connection\ConnectionInterface |
55
|
|
|
*/ |
56
|
|
|
protected $connection; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* The attribute repository instance. |
60
|
|
|
* |
61
|
|
|
* @var \TechDivision\Import\Attribute\Repositories\AttributeRepository |
62
|
|
|
*/ |
63
|
|
|
protected $attributeRepository; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* The attribute label repository instance. |
67
|
|
|
* |
68
|
|
|
* @var \TechDivision\Import\Attribute\Repositories\AttributeLabelRepository |
69
|
|
|
*/ |
70
|
|
|
protected $attributeLabelRepository; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* The attribute option repository instance. |
74
|
|
|
* |
75
|
|
|
* @var \TechDivision\Import\Attribute\Repositories\AttributeOptionRepository |
76
|
|
|
*/ |
77
|
|
|
protected $attributeOptionRepository; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* The repository to access EAV attribute option values. |
81
|
|
|
* |
82
|
|
|
* @var \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository |
83
|
|
|
*/ |
84
|
|
|
protected $eavAttributeOptionValueRepository; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* The attribute option swatch repository instance. |
88
|
|
|
* |
89
|
|
|
* @var \TechDivision\Import\Attribute\Repositories\AttributeOptionSwatchRepository |
90
|
|
|
*/ |
91
|
|
|
protected $attributeOptionSwatchRepository; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* The catalog attribute repository instance. |
95
|
|
|
* |
96
|
|
|
* @var \TechDivision\Import\Attribute\Repositories\CatalogAttributeRepository |
97
|
|
|
*/ |
98
|
|
|
protected $catalogAttributeRepository; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* The entity attribute repository instance. |
102
|
|
|
* |
103
|
|
|
* @var \TechDivision\Import\Attribute\Repositories\EntityAttributeRepository |
104
|
|
|
*/ |
105
|
|
|
protected $entityAttributeRepository; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* The attribute action instance. |
109
|
|
|
* |
110
|
|
|
* @var \TechDivision\Import\Attribute\Actions\AttributeAction |
111
|
|
|
*/ |
112
|
|
|
protected $attributeAction; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* The attribute label action instance. |
116
|
|
|
* |
117
|
|
|
* @var \TechDivision\Import\Attribute\Actions\AttributeLabelAction |
118
|
|
|
*/ |
119
|
|
|
protected $attributeLabelAction; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* The attribute option action instance. |
123
|
|
|
* |
124
|
|
|
* @var \TechDivision\Import\Attribute\Actions\AttributeOptionAction |
125
|
|
|
*/ |
126
|
|
|
protected $attributeOptionAction; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* The attribute option value action instance. |
130
|
|
|
* |
131
|
|
|
* @var \TechDivision\Import\Attribute\Actions\AttributeOptionValueAction |
132
|
|
|
*/ |
133
|
|
|
protected $attributeOptionValueAction; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* The attribute option swatch action instance. |
137
|
|
|
* |
138
|
|
|
* @var \TechDivision\Import\Attribute\Actions\AttributeOptionSwatchAction |
139
|
|
|
*/ |
140
|
|
|
protected $attributeOptionSwatchAction; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* The attribute action instance. |
144
|
|
|
* |
145
|
|
|
* @var \TechDivision\Import\Attribute\Actions\CatalogAttributeAction |
146
|
|
|
*/ |
147
|
|
|
protected $catalogAttributeAction; |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* The entity attribute action instance. |
151
|
|
|
* |
152
|
|
|
* @var \TechDivision\Import\Attribute\Actions\EntityAttributeAction |
153
|
|
|
*/ |
154
|
|
|
protected $entityAttributeAction; |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Initialize the processor with the necessary assembler and repository instances. |
158
|
|
|
* |
159
|
|
|
* @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to use |
160
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeRepository $attributeRepository The attribute repository instance |
161
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeLabelRepository $attributeLabelRepository The attribute label repository instance |
162
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository The attribute repository instance |
163
|
|
|
* @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository $eavAttributeOptionValueRepository The EAV attribute option value repository to use |
164
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeOptionSwatchRepository $attributeOptionSwatchRepository The attribute repository swatch instance |
165
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\CatalogAttributeRepository $catalogAttributeRepository The catalog attribute repository instance |
166
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\EntityAttributeRepository $entityAttributeRepository The entity attribute repository instance |
167
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeAction $attributeAction The attribute action instance |
168
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeLabelAction $attributeLabelAction The attribute label action instance |
169
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeOptionAction $attributeOptionAction The attribute option action instance |
170
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeOptionValueAction $attributeOptionValueAction The attribute option value action instance |
171
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeOptionSwatchAction $attributeOptionSwatchAction The attribute option swatch action instance |
172
|
|
|
* @param \TechDivision\Import\Attribute\Actions\CatalogAttributeAction $catalogAttributeAction The catalog attribute action instance |
173
|
|
|
* @param \TechDivision\Import\Attribute\Actions\EntityAttributeAction $entityAttributeAction The entity attribute action instance |
174
|
|
|
*/ |
175
|
|
|
public function __construct( |
176
|
|
|
ConnectionInterface $connection, |
177
|
|
|
AttributeRepository $attributeRepository, |
178
|
|
|
AttributeLabelRepository $attributeLabelRepository, |
179
|
|
|
AttributeOptionRepository $attributeOptionRepository, |
180
|
|
|
EavAttributeOptionValueRepository $eavAttributeOptionValueRepository, |
181
|
|
|
AttributeOptionSwatchRepository $attributeOptionSwatchRepository, |
182
|
|
|
CatalogAttributeRepository $catalogAttributeRepository, |
183
|
|
|
EntityAttributeRepository $entityAttributeRepository, |
184
|
|
|
AttributeAction $attributeAction, |
185
|
|
|
AttributeLabelAction $attributeLabelAction, |
186
|
|
|
AttributeOptionAction $attributeOptionAction, |
187
|
|
|
AttributeOptionValueAction $attributeOptionValueAction, |
188
|
|
|
AttributeOptionSwatchAction $attributeOptionSwatchAction, |
189
|
|
|
CatalogAttributeAction $catalogAttributeAction, |
190
|
|
|
EntityAttributeAction $entityAttributeAction |
191
|
|
|
) { |
192
|
|
|
$this->setConnection($connection); |
193
|
|
|
$this->setAttributeRepository($attributeRepository); |
194
|
|
|
$this->setAttributeLabelRepository($attributeLabelRepository); |
195
|
|
|
$this->setAttributeOptionRepository($attributeOptionRepository); |
196
|
|
|
$this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository); |
|
|
|
|
197
|
|
|
$this->setAttributeOptionSwatchRepository($attributeOptionSwatchRepository); |
198
|
|
|
$this->setCatalogAttributeRepository($catalogAttributeRepository); |
199
|
|
|
$this->setEntityAttributeRepository($entityAttributeRepository); |
200
|
|
|
$this->setAttributeAction($attributeAction); |
201
|
|
|
$this->setAttributeLabelAction($attributeLabelAction); |
202
|
|
|
$this->setAttributeOptionAction($attributeOptionAction); |
203
|
|
|
$this->setAttributeOptionValueAction($attributeOptionValueAction); |
204
|
|
|
$this->setAttributeOptionSwatchAction($attributeOptionSwatchAction); |
205
|
|
|
$this->setCatalogAttributeAction($catalogAttributeAction); |
206
|
|
|
$this->setEntityAttributeAction($entityAttributeAction); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Set's the passed connection. |
211
|
|
|
* |
212
|
|
|
* @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set |
213
|
|
|
* |
214
|
|
|
* @return void |
215
|
|
|
*/ |
216
|
|
|
public function setConnection(ConnectionInterface $connection) |
217
|
|
|
{ |
218
|
|
|
$this->connection = $connection; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Return's the connection. |
223
|
|
|
* |
224
|
|
|
* @return \TechDivision\Import\Connection\ConnectionInterface The connection instance |
225
|
|
|
*/ |
226
|
|
|
public function getConnection() |
227
|
|
|
{ |
228
|
|
|
return $this->connection; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
233
|
|
|
* object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
234
|
|
|
* Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
235
|
|
|
* to autocommit mode. |
236
|
|
|
* |
237
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
238
|
|
|
* @link http://php.net/manual/en/pdo.begintransaction.php |
239
|
|
|
*/ |
240
|
|
|
public function beginTransaction() |
241
|
|
|
{ |
242
|
|
|
return $this->connection->beginTransaction(); |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Commits a transaction, returning the database connection to autocommit mode until the next call to |
247
|
|
|
* ProductProcessor::beginTransaction() starts a new transaction. |
248
|
|
|
* |
249
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
250
|
|
|
* @link http://php.net/manual/en/pdo.commit.php |
251
|
|
|
*/ |
252
|
|
|
public function commit() |
253
|
|
|
{ |
254
|
|
|
return $this->connection->commit(); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
259
|
|
|
* |
260
|
|
|
* If the database was set to autocommit mode, this function will restore autocommit mode after it has |
261
|
|
|
* rolled back the transaction. |
262
|
|
|
* |
263
|
|
|
* Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
264
|
|
|
* language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
265
|
|
|
* COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
266
|
|
|
* |
267
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
268
|
|
|
* @link http://php.net/manual/en/pdo.rollback.php |
269
|
|
|
*/ |
270
|
|
|
public function rollBack() |
271
|
|
|
{ |
272
|
|
|
return $this->connection->rollBack(); |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Set's the attribute repository instance. |
277
|
|
|
* |
278
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeRepository $attributeRepository The attribute repository instance |
279
|
|
|
* |
280
|
|
|
* @return void |
281
|
|
|
*/ |
282
|
|
|
public function setAttributeRepository(AttributeRepository $attributeRepository) |
283
|
|
|
{ |
284
|
|
|
$this->attributeRepository = $attributeRepository; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Return's the attribute repository instance. |
289
|
|
|
* |
290
|
|
|
* @return \TechDivision\Import\Attribute\Repositories\AttributeRepository The attribute repository instance |
291
|
|
|
*/ |
292
|
|
|
public function getAttributeRepository() |
293
|
|
|
{ |
294
|
|
|
return $this->attributeRepository; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Set's the attribute label repository instance. |
299
|
|
|
* |
300
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeLabelRepository $attributeLabelRepository The attribute label repository instance |
301
|
|
|
* |
302
|
|
|
* @return void |
303
|
|
|
*/ |
304
|
|
|
public function setAttributeLabelRepository(AttributeLabelRepository $attributeLabelRepository) |
305
|
|
|
{ |
306
|
|
|
$this->attributeLabelRepository = $attributeLabelRepository; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* Return's the attribute label repository instance. |
311
|
|
|
* |
312
|
|
|
* @return \TechDivision\Import\Attribute\Repositories\AttributeRepository The attribute label repository instance |
313
|
|
|
*/ |
314
|
|
|
public function getAttributeLabelRepository() |
315
|
|
|
{ |
316
|
|
|
return $this->attributeLabelRepository; |
|
|
|
|
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* Set's the attribute option repository instance. |
321
|
|
|
* |
322
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository The attribute option repository instance |
323
|
|
|
* |
324
|
|
|
* @return void |
325
|
|
|
*/ |
326
|
|
|
public function setAttributeOptionRepository(AttributeOptionRepository $attributeOptionRepository) |
327
|
|
|
{ |
328
|
|
|
$this->attributeOptionRepository = $attributeOptionRepository; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
/** |
332
|
|
|
* Return's the attribute option repository instance. |
333
|
|
|
* |
334
|
|
|
* @return \TechDivision\Import\Attribute\Repositories\AttributeOptionRepository The attribute option repository instance |
335
|
|
|
*/ |
336
|
|
|
public function getAttributeOptionRepository() |
337
|
|
|
{ |
338
|
|
|
return $this->attributeOptionRepository; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Set's the repository to access EAV attribute option values. |
343
|
|
|
* |
344
|
|
|
* @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository $eavAttributeOptionValueRepository The repository to access EAV attribute option values |
345
|
|
|
* |
346
|
|
|
* @return void |
347
|
|
|
*/ |
348
|
|
|
public function setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository) |
349
|
|
|
{ |
350
|
|
|
$this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* Return's the repository to access EAV attribute option values. |
355
|
|
|
* |
356
|
|
|
* @return \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository The repository instance |
357
|
|
|
*/ |
358
|
|
|
public function getEavAttributeOptionValueRepository() |
359
|
|
|
{ |
360
|
|
|
return $this->eavAttributeOptionValueRepository; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* Set's the attribute option swatch repository instance. |
365
|
|
|
* |
366
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\AttributeOptionSwatchRepository $attributeOptionSwatchRepository The attribute option swatch repository instance |
367
|
|
|
* |
368
|
|
|
* @return void |
369
|
|
|
*/ |
370
|
|
|
public function setAttributeOptionSwatchRepository(AttributeOptionSwatchRepository $attributeOptionSwatchRepository) |
371
|
|
|
{ |
372
|
|
|
$this->attributeOptionSwatchRepository = $attributeOptionSwatchRepository; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* Return's the attribute option swatch repository instance. |
377
|
|
|
* |
378
|
|
|
* @return \TechDivision\Import\Attribute\Repositories\AttributeOptionSwatchRepository The attribute option swatch repository instance |
379
|
|
|
*/ |
380
|
|
|
public function getAttributeOptionSwatchRepository() |
381
|
|
|
{ |
382
|
|
|
return $this->attributeOptionSwatchRepository; |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* Set's the catalog attribute repository instance. |
387
|
|
|
* |
388
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\CatalogAttributeRepository $catalogAttributeRepository The catalog attribute repository instance |
389
|
|
|
* |
390
|
|
|
* @return void |
391
|
|
|
*/ |
392
|
|
|
public function setCatalogAttributeRepository(CatalogAttributeRepository $catalogAttributeRepository) |
393
|
|
|
{ |
394
|
|
|
$this->catalogAttributeRepository = $catalogAttributeRepository; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* Return's the catalog attribute repository instance. |
399
|
|
|
* |
400
|
|
|
* @return \TechDivision\Import\Attribute\Repositories\CatalogAttributeRepository The catalog attribute repository instance |
401
|
|
|
*/ |
402
|
|
|
public function getCatalogAttributeRepository() |
403
|
|
|
{ |
404
|
|
|
return $this->catalogAttributeRepository; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Set's the entity attribute repository instance. |
409
|
|
|
* |
410
|
|
|
* @param \TechDivision\Import\Attribute\Repositories\EntityAttributeRepository $entityAttributeRepository The entity attribute repository instance |
411
|
|
|
* |
412
|
|
|
* @return void |
413
|
|
|
*/ |
414
|
|
|
public function setEntityAttributeRepository(EntityAttributeRepository $entityAttributeRepository) |
415
|
|
|
{ |
416
|
|
|
$this->entityAttributeRepository = $entityAttributeRepository; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* Return's the entity attribute repository instance. |
421
|
|
|
* |
422
|
|
|
* @return \TechDivision\Import\Attribute\Repositories\EntityAttributeRepository The entity attribute repository instance |
423
|
|
|
*/ |
424
|
|
|
public function getEntityAttributeRepository() |
425
|
|
|
{ |
426
|
|
|
return $this->entityAttributeRepository; |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* Set's the attribute action instance. |
431
|
|
|
* |
432
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeAction $attributeAction The attribute action instance |
433
|
|
|
* |
434
|
|
|
* @return void |
435
|
|
|
*/ |
436
|
|
|
public function setAttributeAction(AttributeAction $attributeAction) |
437
|
|
|
{ |
438
|
|
|
$this->attributeAction = $attributeAction; |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* Return's the attribute action instance. |
443
|
|
|
* |
444
|
|
|
* @return \TechDivision\Import\Attribute\Actions\AttributeAction The attribute action instance |
445
|
|
|
*/ |
446
|
|
|
public function getAttributeAction() |
447
|
|
|
{ |
448
|
|
|
return $this->attributeAction; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* Set's the attribute label action instance. |
453
|
|
|
* |
454
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeLabelAction $attributeLabelAction The attribute label action instance |
455
|
|
|
* |
456
|
|
|
* @return void |
457
|
|
|
*/ |
458
|
|
|
public function setAttributeLabelAction(AttributeLabelAction $attributeLabelAction) |
459
|
|
|
{ |
460
|
|
|
$this->attributeLabelAction = $attributeLabelAction; |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* Return's the attribute label action instance. |
465
|
|
|
* |
466
|
|
|
* @return \TechDivision\Import\Attribute\Actions\AttributeAction The attribute label action instance |
467
|
|
|
*/ |
468
|
|
|
public function getAttributeLabelAction() |
469
|
|
|
{ |
470
|
|
|
return $this->attributeLabelAction; |
|
|
|
|
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
/** |
474
|
|
|
* Set's the attribute option action instance. |
475
|
|
|
* |
476
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeOptionAction $attributeOptionAction The attribute option action instance |
477
|
|
|
* |
478
|
|
|
* @return void |
479
|
|
|
*/ |
480
|
|
|
public function setAttributeOptionAction(AttributeOptionAction $attributeOptionAction) |
481
|
|
|
{ |
482
|
|
|
$this->attributeOptionAction = $attributeOptionAction; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* Return's the attribute option action instance. |
487
|
|
|
* |
488
|
|
|
* @return \TechDivision\Import\Attribute\Actions\AttributeOptionAction The attribute option action instance |
489
|
|
|
*/ |
490
|
|
|
public function getAttributeOptionAction() |
491
|
|
|
{ |
492
|
|
|
return $this->attributeOptionAction; |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* Set's the attribute option value action instance. |
497
|
|
|
* |
498
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeOptionValueAction $attributeOptionValueAction The attribute option value action instance |
499
|
|
|
* |
500
|
|
|
* @return void |
501
|
|
|
*/ |
502
|
|
|
public function setAttributeOptionValueAction(AttributeOptionValueAction $attributeOptionValueAction) |
503
|
|
|
{ |
504
|
|
|
$this->attributeOptionValueAction = $attributeOptionValueAction; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* Return's the attribute option value action instance. |
509
|
|
|
* |
510
|
|
|
* @return \TechDivision\Import\Attribute\Actions\AttributeOptionValueAction The attribute option value action instance |
511
|
|
|
*/ |
512
|
|
|
public function getAttributeOptionValueAction() |
513
|
|
|
{ |
514
|
|
|
return $this->attributeOptionValueAction; |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* Set's the attribute option swatch action instance. |
519
|
|
|
* |
520
|
|
|
* @param \TechDivision\Import\Attribute\Actions\AttributeOptionSwatchAction $attributeOptionSwatchAction The attribute option swatch action instance |
521
|
|
|
* |
522
|
|
|
* @return void |
523
|
|
|
*/ |
524
|
|
|
public function setAttributeOptionSwatchAction(AttributeOptionSwatchAction $attributeOptionSwatchAction) |
525
|
|
|
{ |
526
|
|
|
$this->attributeOptionSwatchAction = $attributeOptionSwatchAction; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
/** |
530
|
|
|
* Return's the attribute option swatch action instance. |
531
|
|
|
* |
532
|
|
|
* @return \TechDivision\Import\Attribute\Actions\AttributeOptionSwatchAction The attribute option swatch action instance |
533
|
|
|
*/ |
534
|
|
|
public function getAttributeOptionSwatchAction() |
535
|
|
|
{ |
536
|
|
|
return $this->attributeOptionSwatchAction; |
537
|
|
|
} |
538
|
|
|
|
539
|
|
|
/** |
540
|
|
|
* Set's the catalog attribute action instance. |
541
|
|
|
* |
542
|
|
|
* @param \TechDivision\Import\Attribute\Actions\CatalogAttributeAction $catalogAttributeAction The catalog attribute action instance |
543
|
|
|
* |
544
|
|
|
* @return void |
545
|
|
|
*/ |
546
|
|
|
public function setCatalogAttributeAction(CatalogAttributeAction $catalogAttributeAction) |
547
|
|
|
{ |
548
|
|
|
$this->catalogAttributeAction = $catalogAttributeAction; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
/** |
552
|
|
|
* Return's the catalog attribute action instance. |
553
|
|
|
* |
554
|
|
|
* @return \TechDivision\Import\Attribute\Actions\CatalogAttributeAction The catalog attribute action instance |
555
|
|
|
*/ |
556
|
|
|
public function getCatalogAttributeAction() |
557
|
|
|
{ |
558
|
|
|
return $this->catalogAttributeAction; |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
/** |
562
|
|
|
* Set's the entity attribute action instance. |
563
|
|
|
* |
564
|
|
|
* @param \TechDivision\Import\Attribute\Actions\EntityAttributeAction $entityAttributeAction The entity attribute action instance |
565
|
|
|
* |
566
|
|
|
* @return void |
567
|
|
|
*/ |
568
|
|
|
public function setEntityAttributeAction(EntityAttributeAction $entityAttributeAction) |
569
|
|
|
{ |
570
|
|
|
$this->entityAttributeAction = $entityAttributeAction; |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
/** |
574
|
|
|
* Return's the entity attribute action instance. |
575
|
|
|
* |
576
|
|
|
* @return \TechDivision\Import\Attribute\Actions\EntityAttributeAction The entity attribute action instance |
577
|
|
|
*/ |
578
|
|
|
public function getEntityAttributeAction() |
579
|
|
|
{ |
580
|
|
|
return $this->entityAttributeAction; |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* Load's and return's the EAV attribute with the passed code. |
585
|
|
|
* |
586
|
|
|
* @param string $attributeCode The code of the EAV attribute to load |
587
|
|
|
* |
588
|
|
|
* @return array The EAV attribute |
589
|
|
|
*/ |
590
|
|
|
public function loadAttributeByAttributeCode($attributeCode) |
591
|
|
|
{ |
592
|
|
|
return $this->getAttributeRepository()->findOneByAttributeCode($attributeCode); |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
/** |
596
|
|
|
* Return's the EAV attribute label with the passed attribute code and store ID. |
597
|
|
|
* |
598
|
|
|
* @param string $attributeCode The attribute code of the EAV attribute label to return |
599
|
|
|
* @param integer $storeId The store ID of the EAV attribute label to return |
600
|
|
|
* |
601
|
|
|
* @return array The EAV attribute label |
602
|
|
|
*/ |
603
|
|
|
public function loadAttributeLabelByAttributeCodeAndStoreId($attributeCode, $storeId) |
604
|
|
|
{ |
605
|
|
|
return $this->getAttributeLabelRepository()->findOneByAttributeCodeAndStoreId($attributeCode, $storeId); |
606
|
|
|
} |
607
|
|
|
|
608
|
|
|
/** |
609
|
|
|
* Load's and return's the EAV attribute option with the passed code, store ID and value. |
610
|
|
|
* |
611
|
|
|
* @param string $attributeCode The code of the EAV attribute option to load |
612
|
|
|
* @param integer $storeId The store ID of the attribute option to load |
613
|
|
|
* @param string $value The value of the attribute option to load |
614
|
|
|
* |
615
|
|
|
* @return array The EAV attribute option |
616
|
|
|
*/ |
617
|
|
|
public function loadAttributeOptionByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value) |
618
|
|
|
{ |
619
|
|
|
return $this->getAttributeOptionRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value); |
620
|
|
|
} |
621
|
|
|
|
622
|
|
|
/** |
623
|
|
|
* Load's and return's the EAV attribute option value with the passed code, store ID and value. |
624
|
|
|
* |
625
|
|
|
* @param string $attributeCode The code of the EAV attribute option to load |
626
|
|
|
* @param integer $storeId The store ID of the attribute option to load |
627
|
|
|
* @param string $value The value of the attribute option to load |
628
|
|
|
* |
629
|
|
|
* @return array The EAV attribute option value |
630
|
|
|
*/ |
631
|
|
|
public function loadAttributeOptionValueByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value) |
632
|
|
|
{ |
633
|
|
|
return $this->getEavAttributeOptionValueRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value); |
634
|
|
|
} |
635
|
|
|
|
636
|
|
|
/** |
637
|
|
|
* Load's and return's the EAV attribute option value with the passed option ID and store ID. |
638
|
|
|
* |
639
|
|
|
* @param string $optionId The option ID |
640
|
|
|
* @param integer $storeId The store ID of the attribute option to load |
641
|
|
|
* |
642
|
|
|
* @return array The EAV attribute option value |
643
|
|
|
*/ |
644
|
|
|
public function loadAttributeOptionValueByOptionIdAndStoreId($optionId, $storeId) |
645
|
|
|
{ |
646
|
|
|
return $this->getEavAttributeOptionValueRepository()->findOneByOptionIdAndStoreId($optionId, $storeId); |
647
|
|
|
} |
648
|
|
|
|
649
|
|
|
/** |
650
|
|
|
* Load's and return's the EAV attribute option swatch with the passed code, store ID, value and type. |
651
|
|
|
* |
652
|
|
|
* @param string $attributeCode The code of the EAV attribute option swatch to load |
653
|
|
|
* @param integer $storeId The store ID of the attribute option swatch to load |
654
|
|
|
* @param string $value The value of the attribute option swatch to load |
655
|
|
|
* @param string $type The type of the attribute option swatch to load |
656
|
|
|
* |
657
|
|
|
* @return array The EAV attribute option swatch |
658
|
|
|
*/ |
659
|
|
|
public function loadAttributeOptionSwatchByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value, $type) |
660
|
|
|
{ |
661
|
|
|
return $this->getAttributeOptionSwatchRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value, $type); |
662
|
|
|
} |
663
|
|
|
|
664
|
|
|
/** |
665
|
|
|
* Load's and retur's the EAV catalog attribute with the passed ID. |
666
|
|
|
* |
667
|
|
|
* @param string $attributeId The ID of the EAV catalog attribute to return |
668
|
|
|
* |
669
|
|
|
* @return array The EAV catalog attribute |
670
|
|
|
*/ |
671
|
|
|
public function loadCatalogAttribute($attributeId) |
672
|
|
|
{ |
673
|
|
|
return $this->getCatalogAttributeRepository()->load($attributeId); |
674
|
|
|
} |
675
|
|
|
|
676
|
|
|
/** |
677
|
|
|
* Return's the EAV entity attribute with the passed entity type, attribute, attribute set and attribute group ID. |
678
|
|
|
* |
679
|
|
|
* @param integer $entityTypeId The ID of the EAV entity attribute's entity type to return |
680
|
|
|
* @param integer $attributeId The ID of the EAV entity attribute's attribute to return |
681
|
|
|
* @param integer $attributeSetId The ID of the EAV entity attribute's attribute set to return |
682
|
|
|
* @param integer $attributeGroupId The ID of the EAV entity attribute's attribute group to return |
683
|
|
|
* |
684
|
|
|
* @return array The EAV entity attribute |
685
|
|
|
*/ |
686
|
|
|
public function loadEntityAttributeByEntityTypeAndAttributeIdAndAttributeSetIdAndAttributeGroupId($entityTypeId, $attributeId, $attributeSetId, $attributeGroupId) |
687
|
|
|
{ |
688
|
|
|
return $this->getEntityAttributeRepository()->findOneByEntityTypeAndAttributeIdAndAttributeSetIdAndAttributeGroupId($entityTypeId, $attributeId, $attributeSetId, $attributeGroupId); |
689
|
|
|
} |
690
|
|
|
|
691
|
|
|
/** |
692
|
|
|
* Persist's the passed EAV attribute data and return's the ID. |
693
|
|
|
* |
694
|
|
|
* @param array $attribute The attribute data to persist |
695
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
696
|
|
|
* |
697
|
|
|
* @return string The ID of the persisted attribute |
698
|
|
|
*/ |
699
|
|
|
public function persistAttribute(array $attribute, $name = null) |
700
|
|
|
{ |
701
|
|
|
return $this->getAttributeAction()->persist($attribute, $name); |
|
|
|
|
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
/** |
705
|
|
|
* Persist the passed attribute label. |
706
|
|
|
* |
707
|
|
|
* @param array $attributeLabel The attribute label to persist |
708
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
709
|
|
|
* |
710
|
|
|
* @return void |
711
|
|
|
*/ |
712
|
|
|
public function persistAttributeLabel(array $attributeLabel, $name = null) |
713
|
|
|
{ |
714
|
|
|
$this->getAttributeLabelAction()->persist($attributeLabel, $name); |
|
|
|
|
715
|
|
|
} |
716
|
|
|
|
717
|
|
|
/** |
718
|
|
|
* Persist's the passed EAV attribute option data and return's the ID. |
719
|
|
|
* |
720
|
|
|
* @param array $attributeOption The attribute option data to persist |
721
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
722
|
|
|
* |
723
|
|
|
* @return string The ID of the persisted attribute |
724
|
|
|
*/ |
725
|
|
|
public function persistAttributeOption(array $attributeOption, $name = null) |
726
|
|
|
{ |
727
|
|
|
return $this->getAttributeOptionAction()->persist($attributeOption, $name); |
|
|
|
|
728
|
|
|
} |
729
|
|
|
|
730
|
|
|
/** |
731
|
|
|
* Persist's the passed EAV attribute option value data and return's the ID. |
732
|
|
|
* |
733
|
|
|
* @param array $attributeOptionValue The attribute option value data to persist |
734
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
735
|
|
|
* |
736
|
|
|
* @return void |
737
|
|
|
*/ |
738
|
|
|
public function persistAttributeOptionValue(array $attributeOptionValue, $name = null) |
739
|
|
|
{ |
740
|
|
|
$this->getAttributeOptionValueAction()->persist($attributeOptionValue, $name); |
|
|
|
|
741
|
|
|
} |
742
|
|
|
|
743
|
|
|
/** |
744
|
|
|
* Persist the passed attribute option swatch. |
745
|
|
|
* |
746
|
|
|
* @param array $attributeOptionSwatch The attribute option swatch to persist |
747
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
748
|
|
|
* |
749
|
|
|
* @return void |
750
|
|
|
*/ |
751
|
|
|
public function persistAttributeOptionSwatch(array $attributeOptionSwatch, $name = null) |
752
|
|
|
{ |
753
|
|
|
$this->getAttributeOptionSwatchAction()->persist($attributeOptionSwatch, $name); |
|
|
|
|
754
|
|
|
} |
755
|
|
|
|
756
|
|
|
/** |
757
|
|
|
* Persist's the passed EAV catalog attribute data and return's the ID. |
758
|
|
|
* |
759
|
|
|
* @param array $catalogAttribute The catalog attribute data to persist |
760
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
761
|
|
|
* |
762
|
|
|
* @return void |
763
|
|
|
*/ |
764
|
|
|
public function persistCatalogAttribute(array $catalogAttribute, $name = null) |
765
|
|
|
{ |
766
|
|
|
$this->getCatalogAttributeAction()->persist($catalogAttribute, $name); |
|
|
|
|
767
|
|
|
} |
768
|
|
|
|
769
|
|
|
/** |
770
|
|
|
* Persist's the passed EAV entity attribute data and return's the ID. |
771
|
|
|
* |
772
|
|
|
* @param array $entityAttribute The entity attribute data to persist |
773
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
774
|
|
|
* |
775
|
|
|
* @return void |
776
|
|
|
*/ |
777
|
|
|
public function persistEntityAttribute(array $entityAttribute, $name = null) |
778
|
|
|
{ |
779
|
|
|
$this->getEntityAttributeAction()->persist($entityAttribute, $name); |
|
|
|
|
780
|
|
|
} |
781
|
|
|
|
782
|
|
|
/** |
783
|
|
|
* Delete's the EAV attribute with the passed attributes. |
784
|
|
|
* |
785
|
|
|
* @param array $row The attributes of the EAV attribute to delete |
786
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
787
|
|
|
* |
788
|
|
|
* @return void |
789
|
|
|
*/ |
790
|
|
|
public function deleteAttribute($row, $name = null) |
791
|
|
|
{ |
792
|
|
|
$this->getAttributeAction()->delete($row, $name); |
793
|
|
|
} |
794
|
|
|
} |
795
|
|
|
|
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: