1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Customer\Services\CustomerBunchProcessor |
5
|
|
|
* |
6
|
|
|
* PHP version 7 |
7
|
|
|
* |
8
|
|
|
* @author Tim Wagner <[email protected]> |
9
|
|
|
* @copyright 2018 TechDivision GmbH <[email protected]> |
10
|
|
|
* @license https://opensource.org/licenses/MIT |
11
|
|
|
* @link https://github.com/techdivision/import-customer |
12
|
|
|
* @link http://www.techdivision.com |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace TechDivision\Import\Customer\Services; |
16
|
|
|
|
17
|
|
|
use TechDivision\Import\Loaders\LoaderInterface; |
18
|
|
|
use TechDivision\Import\Dbal\Actions\ActionInterface; |
19
|
|
|
use TechDivision\Import\Dbal\Connection\ConnectionInterface; |
20
|
|
|
use TechDivision\Import\Repositories\EavAttributeRepositoryInterface; |
21
|
|
|
use TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface; |
22
|
|
|
use TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface; |
23
|
|
|
use TechDivision\Import\Customer\Assemblers\CustomerAttributeAssemblerInterface; |
24
|
|
|
use TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* The customer bunch processor implementation. |
28
|
|
|
* |
29
|
|
|
* @author Tim Wagner <[email protected]> |
30
|
|
|
* @copyright 2018 TechDivision GmbH <[email protected]> |
31
|
|
|
* @license https://opensource.org/licenses/MIT |
32
|
|
|
* @link https://github.com/techdivision/import-customer |
33
|
|
|
* @link http://www.techdivision.com |
34
|
|
|
*/ |
35
|
|
|
class CustomerBunchProcessor implements CustomerBunchProcessorInterface |
36
|
|
|
{ |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* A PDO connection initialized with the values from the Doctrine EntityManager. |
40
|
|
|
* |
41
|
|
|
* @var \TechDivision\Import\Dbal\Connection\ConnectionInterface |
42
|
|
|
*/ |
43
|
|
|
protected $connection; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The repository to access EAV attribute option values. |
47
|
|
|
* |
48
|
|
|
* @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface |
49
|
|
|
*/ |
50
|
|
|
protected $eavAttributeOptionValueRepository; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The repository to access customer data. |
54
|
|
|
* |
55
|
|
|
* @var \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface |
56
|
|
|
*/ |
57
|
|
|
protected $customerRepository; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The repository to access EAV attributes. |
61
|
|
|
* |
62
|
|
|
* @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface |
63
|
|
|
*/ |
64
|
|
|
protected $eavAttributeRepository; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* The repository to access EAV attributes. |
68
|
|
|
* |
69
|
|
|
* @var \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface |
70
|
|
|
*/ |
71
|
|
|
protected $eavEntityTypeRepository; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The action for customer CRUD methods. |
75
|
|
|
* |
76
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
77
|
|
|
*/ |
78
|
|
|
protected $customerAction; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* The action for customer varchar attribute CRUD methods. |
82
|
|
|
* |
83
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
84
|
|
|
*/ |
85
|
|
|
protected $customerVarcharAction; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* The action for customer text attribute CRUD methods. |
89
|
|
|
* |
90
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
91
|
|
|
*/ |
92
|
|
|
protected $customerTextAction; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* The action for customer int attribute CRUD methods. |
96
|
|
|
* |
97
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
98
|
|
|
*/ |
99
|
|
|
protected $customerIntAction; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* The action for customer decimal attribute CRUD methods. |
103
|
|
|
* |
104
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
105
|
|
|
*/ |
106
|
|
|
protected $customerDecimalAction; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* The action for customer datetime attribute CRUD methods. |
110
|
|
|
* |
111
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
112
|
|
|
*/ |
113
|
|
|
protected $customerDatetimeAction; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* The assembler to load the customer attributes with. |
117
|
|
|
* |
118
|
|
|
* @var \TechDivision\Import\Customer\Assemblers\CustomerAttributeAssemblerInterface |
119
|
|
|
*/ |
120
|
|
|
protected $customerAttributeAssembler; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* The raw entity loader instance. |
124
|
|
|
* |
125
|
|
|
* @var \TechDivision\Import\Loaders\LoaderInterface |
126
|
|
|
*/ |
127
|
|
|
protected $rawEntityLoader; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Initialize the processor with the necessary assembler and repository instances. |
131
|
|
|
* |
132
|
|
|
* @param \TechDivision\Import\Dbal\Connection\ConnectionInterface $connection The connection to use |
133
|
|
|
* @param \TechDivision\Import\Customer\Assemblers\CustomerAttributeAssemblerInterface $customerAttributeAssembler The customer attribute assembler to use |
134
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The EAV attribute option value repository to use |
135
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The EAV attribute repository to use |
136
|
|
|
* @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface $customerRepository The customer repository to use |
137
|
|
|
* @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The EAV entity type repository to use |
138
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAction The customer action to use |
139
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerDatetimeAction The customer datetime action to use |
140
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerDecimalAction The customer decimal action to use |
141
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerIntAction The customer integer action to use |
142
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerTextAction The customer text action to use |
143
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerVarcharAction The customer varchar action to use |
144
|
|
|
* @param \TechDivision\Import\Loaders\LoaderInterface $rawEntityLoader The raw entity loader instance |
145
|
|
|
*/ |
146
|
|
|
public function __construct( |
147
|
|
|
ConnectionInterface $connection, |
148
|
|
|
CustomerAttributeAssemblerInterface $customerAttributeAssembler, |
149
|
|
|
EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository, |
150
|
|
|
EavAttributeRepositoryInterface $eavAttributeRepository, |
151
|
|
|
CustomerRepositoryInterface $customerRepository, |
152
|
|
|
EavEntityTypeRepositoryInterface $eavEntityTypeRepository, |
153
|
|
|
ActionInterface $customerAction, |
154
|
|
|
ActionInterface $customerDatetimeAction, |
155
|
|
|
ActionInterface $customerDecimalAction, |
156
|
|
|
ActionInterface $customerIntAction, |
157
|
|
|
ActionInterface $customerTextAction, |
158
|
|
|
ActionInterface $customerVarcharAction, |
159
|
|
|
LoaderInterface $rawEntityLoader |
160
|
|
|
) { |
161
|
|
|
$this->setConnection($connection); |
162
|
|
|
$this->setCustomerAttributeAssembler($customerAttributeAssembler); |
163
|
|
|
$this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository); |
164
|
|
|
$this->setEavAttributeRepository($eavAttributeRepository); |
165
|
|
|
$this->setCustomerRepository($customerRepository); |
166
|
|
|
$this->setEavEntityTypeRepository($eavEntityTypeRepository); |
167
|
|
|
$this->setCustomerAction($customerAction); |
168
|
|
|
$this->setCustomerDatetimeAction($customerDatetimeAction); |
169
|
|
|
$this->setCustomerDecimalAction($customerDecimalAction); |
170
|
|
|
$this->setCustomerIntAction($customerIntAction); |
171
|
|
|
$this->setCustomerTextAction($customerTextAction); |
172
|
|
|
$this->setCustomerVarcharAction($customerVarcharAction); |
173
|
|
|
$this->setRawEntityLoader($rawEntityLoader); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Set's the raw entity loader instance. |
178
|
|
|
* |
179
|
|
|
* @param \TechDivision\Import\Loaders\LoaderInterface $rawEntityLoader The raw entity loader instance to set |
180
|
|
|
* |
181
|
|
|
* @return void |
182
|
|
|
*/ |
183
|
|
|
public function setRawEntityLoader(LoaderInterface $rawEntityLoader) |
184
|
|
|
{ |
185
|
|
|
$this->rawEntityLoader = $rawEntityLoader; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Return's the raw entity loader instance. |
190
|
|
|
* |
191
|
|
|
* @return \TechDivision\Import\Loaders\LoaderInterface The raw entity loader instance |
192
|
|
|
*/ |
193
|
|
|
public function getRawEntityLoader() |
194
|
|
|
{ |
195
|
|
|
return $this->rawEntityLoader; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Set's the passed connection. |
200
|
|
|
* |
201
|
|
|
* @param \TechDivision\Import\Dbal\Connection\ConnectionInterface $connection The connection to set |
202
|
|
|
* |
203
|
|
|
* @return void |
204
|
|
|
*/ |
205
|
|
|
public function setConnection(ConnectionInterface $connection) |
206
|
|
|
{ |
207
|
|
|
$this->connection = $connection; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Return's the connection. |
212
|
|
|
* |
213
|
|
|
* @return \TechDivision\Import\Dbal\Connection\ConnectionInterface The connection instance |
214
|
|
|
*/ |
215
|
|
|
public function getConnection() |
216
|
|
|
{ |
217
|
|
|
return $this->connection; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
222
|
|
|
* object instance are not committed until you end the transaction by calling CustomerProcessor::commit(). |
223
|
|
|
* Calling CustomerProcessor::rollBack() will roll back all changes to the database and return the connection |
224
|
|
|
* to autocommit mode. |
225
|
|
|
* |
226
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
227
|
|
|
* @link http://php.net/manual/en/pdo.begintransaction.php |
228
|
|
|
*/ |
229
|
|
|
public function beginTransaction() |
230
|
|
|
{ |
231
|
|
|
return $this->connection->beginTransaction(); |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Commits a transaction, returning the database connection to autocommit mode until the next call to |
236
|
|
|
* CustomerProcessor::beginTransaction() starts a new transaction. |
237
|
|
|
* |
238
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
239
|
|
|
* @link http://php.net/manual/en/pdo.commit.php |
240
|
|
|
*/ |
241
|
|
|
public function commit() |
242
|
|
|
{ |
243
|
|
|
return $this->connection->commit(); |
|
|
|
|
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* Rolls back the current transaction, as initiated by CustomerProcessor::beginTransaction(). |
248
|
|
|
* |
249
|
|
|
* If the database was set to autocommit mode, this function will restore autocommit mode after it has |
250
|
|
|
* rolled back the transaction. |
251
|
|
|
* |
252
|
|
|
* Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
253
|
|
|
* language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
254
|
|
|
* COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
255
|
|
|
* |
256
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
257
|
|
|
* @link http://php.net/manual/en/pdo.rollback.php |
258
|
|
|
*/ |
259
|
|
|
public function rollBack() |
260
|
|
|
{ |
261
|
|
|
return $this->connection->rollBack(); |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* Set's the repository to load the customers with. |
266
|
|
|
* |
267
|
|
|
* @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface $customerRepository The repository instance |
268
|
|
|
* |
269
|
|
|
* @return void |
270
|
|
|
*/ |
271
|
|
|
public function setCustomerRepository(CustomerRepositoryInterface $customerRepository) |
272
|
|
|
{ |
273
|
|
|
$this->customerRepository = $customerRepository; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* Return's the repository to load the customers with. |
278
|
|
|
* |
279
|
|
|
* @return \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface The repository instance |
280
|
|
|
*/ |
281
|
|
|
public function getCustomerRepository() |
282
|
|
|
{ |
283
|
|
|
return $this->customerRepository; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* Set's the action with the customer CRUD methods. |
288
|
|
|
* |
289
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerAction The action with the customer CRUD methods |
290
|
|
|
* |
291
|
|
|
* @return void |
292
|
|
|
*/ |
293
|
|
|
public function setCustomerAction(ActionInterface $customerAction) |
294
|
|
|
{ |
295
|
|
|
$this->customerAction = $customerAction; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Return's the action with the customer CRUD methods. |
300
|
|
|
* |
301
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance |
302
|
|
|
*/ |
303
|
|
|
public function getCustomerAction() |
304
|
|
|
{ |
305
|
|
|
return $this->customerAction; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Set's the action with the customer varchar attribute CRUD methods. |
310
|
|
|
* |
311
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerVarcharAction The action with the customer varchar attriute CRUD methods |
312
|
|
|
* |
313
|
|
|
* @return void |
314
|
|
|
*/ |
315
|
|
|
public function setCustomerVarcharAction(ActionInterface $customerVarcharAction) |
316
|
|
|
{ |
317
|
|
|
$this->customerVarcharAction = $customerVarcharAction; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* Return's the action with the customer varchar attribute CRUD methods. |
322
|
|
|
* |
323
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance |
324
|
|
|
*/ |
325
|
|
|
public function getCustomerVarcharAction() |
326
|
|
|
{ |
327
|
|
|
return $this->customerVarcharAction; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* Set's the action with the customer text attribute CRUD methods. |
332
|
|
|
* |
333
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerTextAction The action with the customer text attriute CRUD methods |
334
|
|
|
* |
335
|
|
|
* @return void |
336
|
|
|
*/ |
337
|
|
|
public function setCustomerTextAction(ActionInterface $customerTextAction) |
338
|
|
|
{ |
339
|
|
|
$this->customerTextAction = $customerTextAction; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Return's the action with the customer text attribute CRUD methods. |
344
|
|
|
* |
345
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance |
346
|
|
|
*/ |
347
|
|
|
public function getCustomerTextAction() |
348
|
|
|
{ |
349
|
|
|
return $this->customerTextAction; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Set's the action with the customer int attribute CRUD methods. |
354
|
|
|
* |
355
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerIntAction The action with the customer int attriute CRUD methods |
356
|
|
|
* |
357
|
|
|
* @return void |
358
|
|
|
*/ |
359
|
|
|
public function setCustomerIntAction(ActionInterface $customerIntAction) |
360
|
|
|
{ |
361
|
|
|
$this->customerIntAction = $customerIntAction; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* Return's the action with the customer int attribute CRUD methods. |
366
|
|
|
* |
367
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance |
368
|
|
|
*/ |
369
|
|
|
public function getCustomerIntAction() |
370
|
|
|
{ |
371
|
|
|
return $this->customerIntAction; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* Set's the action with the customer decimal attribute CRUD methods. |
376
|
|
|
* |
377
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerDecimalAction The action with the customer decimal attriute CRUD methods |
378
|
|
|
* |
379
|
|
|
* @return void |
380
|
|
|
*/ |
381
|
|
|
public function setCustomerDecimalAction(ActionInterface $customerDecimalAction) |
382
|
|
|
{ |
383
|
|
|
$this->customerDecimalAction = $customerDecimalAction; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* Return's the action with the customer decimal attribute CRUD methods. |
388
|
|
|
* |
389
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance |
390
|
|
|
*/ |
391
|
|
|
public function getCustomerDecimalAction() |
392
|
|
|
{ |
393
|
|
|
return $this->customerDecimalAction; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* Set's the action with the customer datetime attribute CRUD methods. |
398
|
|
|
* |
399
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $customerDatetimeAction The action with the customer datetime attriute CRUD methods |
400
|
|
|
* |
401
|
|
|
* @return void |
402
|
|
|
*/ |
403
|
|
|
public function setCustomerDatetimeAction(ActionInterface $customerDatetimeAction) |
404
|
|
|
{ |
405
|
|
|
$this->customerDatetimeAction = $customerDatetimeAction; |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Return's the action with the customer datetime attribute CRUD methods. |
410
|
|
|
* |
411
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance |
412
|
|
|
*/ |
413
|
|
|
public function getCustomerDatetimeAction() |
414
|
|
|
{ |
415
|
|
|
return $this->customerDatetimeAction; |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* Set's the repository to access EAV attribute option values. |
420
|
|
|
* |
421
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option values |
422
|
|
|
* |
423
|
|
|
* @return void |
424
|
|
|
*/ |
425
|
|
|
public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository) |
426
|
|
|
{ |
427
|
|
|
$this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository; |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* Return's the repository to access EAV attribute option values. |
432
|
|
|
* |
433
|
|
|
* @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance |
434
|
|
|
*/ |
435
|
|
|
public function getEavAttributeOptionValueRepository() |
436
|
|
|
{ |
437
|
|
|
return $this->eavAttributeOptionValueRepository; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* Set's the repository to access EAV attributes. |
442
|
|
|
* |
443
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes |
444
|
|
|
* |
445
|
|
|
* @return void |
446
|
|
|
*/ |
447
|
|
|
public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository) |
448
|
|
|
{ |
449
|
|
|
$this->eavAttributeRepository = $eavAttributeRepository; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Return's the repository to access EAV attributes. |
454
|
|
|
* |
455
|
|
|
* @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance |
456
|
|
|
*/ |
457
|
|
|
public function getEavAttributeRepository() |
458
|
|
|
{ |
459
|
|
|
return $this->eavAttributeRepository; |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
/** |
463
|
|
|
* Set's the repository to access EAV entity types. |
464
|
|
|
* |
465
|
|
|
* @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The repository to access EAV entity types |
466
|
|
|
* |
467
|
|
|
* @return void |
468
|
|
|
*/ |
469
|
|
|
public function setEavEntityTypeRepository(EavEntityTypeRepositoryInterface $eavEntityTypeRepository) |
470
|
|
|
{ |
471
|
|
|
$this->eavEntityTypeRepository = $eavEntityTypeRepository; |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
/** |
475
|
|
|
* Return's the repository to access EAV entity types. |
476
|
|
|
* |
477
|
|
|
* @return \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface The repository instance |
478
|
|
|
*/ |
479
|
|
|
public function getEavEntityTypeRepository() |
480
|
|
|
{ |
481
|
|
|
return $this->eavEntityTypeRepository; |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
/** |
485
|
|
|
* Set's the assembler to load the customer attributes with. |
486
|
|
|
* |
487
|
|
|
* @param \TechDivision\Import\Customer\Assemblers\CustomerAttributeAssemblerInterface $customerAttributeAssembler The assembler instance |
488
|
|
|
* |
489
|
|
|
* @return void |
490
|
|
|
*/ |
491
|
|
|
public function setCustomerAttributeAssembler(CustomerAttributeAssemblerInterface $customerAttributeAssembler) |
492
|
|
|
{ |
493
|
|
|
$this->customerAttributeAssembler = $customerAttributeAssembler; |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
497
|
|
|
* Return's the assembler to load the customer attributes with. |
498
|
|
|
* |
499
|
|
|
* @return \TechDivision\Import\Customer\Assemblers\CustomerAttributeAssemblerInterface The assembler instance |
500
|
|
|
*/ |
501
|
|
|
public function getCustomerAttributeAssembler() |
502
|
|
|
{ |
503
|
|
|
return $this->customerAttributeAssembler; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* Return's an array with the available EAV attributes for the passed is user defined flag. |
508
|
|
|
* |
509
|
|
|
* @param integer $isUserDefined The flag itself |
510
|
|
|
* |
511
|
|
|
* @return array The array with the EAV attributes matching the passed flag |
512
|
|
|
*/ |
513
|
|
|
public function getEavAttributeByIsUserDefined($isUserDefined = 1) |
514
|
|
|
{ |
515
|
|
|
return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined); |
516
|
|
|
} |
517
|
|
|
|
518
|
|
|
/** |
519
|
|
|
* Intializes the existing attributes for the entity with the passed entity ID. |
520
|
|
|
* |
521
|
|
|
* @param integer $entityId The entity ID of the entity to load the attributes for |
522
|
|
|
* |
523
|
|
|
* @return array The entity attributes |
524
|
|
|
*/ |
525
|
|
|
public function getCustomerAttributesByEntityId($entityId) |
526
|
|
|
{ |
527
|
|
|
return $this->getCustomerAttributeAssembler()->getCustomerAttributesByEntityId($entityId); |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
/** |
531
|
|
|
* Load's and return's a raw entity without primary key but the mandatory members only and nulled values. |
532
|
|
|
* |
533
|
|
|
* @param string $entityTypeCode The entity type code to return the raw entity for |
534
|
|
|
* @param array $data An array with data that will be used to initialize the raw entity with |
535
|
|
|
* |
536
|
|
|
* @return array The initialized entity |
537
|
|
|
*/ |
538
|
|
|
public function loadRawEntity($entityTypeCode, array $data = array()) |
539
|
|
|
{ |
540
|
|
|
return $this->getRawEntityLoader()->load($entityTypeCode, $data); |
|
|
|
|
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* Load's and return's the EAV attribute option value with the passed entity type ID, code, store ID and value. |
545
|
|
|
* |
546
|
|
|
* @param string $entityTypeId The entity type ID of the EAV attribute to load the option value for |
547
|
|
|
* @param string $attributeCode The code of the EAV attribute option to load |
548
|
|
|
* @param integer $storeId The store ID of the attribute option to load |
549
|
|
|
* @param string $value The value of the attribute option to load |
550
|
|
|
* |
551
|
|
|
* @return array The EAV attribute option value |
552
|
|
|
*/ |
553
|
|
|
public function loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value) |
554
|
|
|
{ |
555
|
|
|
return $this->getEavAttributeOptionValueRepository()->findOneByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value); |
556
|
|
|
} |
557
|
|
|
|
558
|
|
|
/** |
559
|
|
|
* Return's an EAV entity type with the passed entity type code. |
560
|
|
|
* |
561
|
|
|
* @param string $entityTypeCode The code of the entity type to return |
562
|
|
|
* |
563
|
|
|
* @return array The entity type with the passed entity type code |
564
|
|
|
*/ |
565
|
|
|
public function loadEavEntityTypeByEntityTypeCode($entityTypeCode) |
566
|
|
|
{ |
567
|
|
|
return $this->getEavEntityTypeRepository()->findOneByEntityTypeCode($entityTypeCode); |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* Return's the customer with the passed email and website ID. |
572
|
|
|
* |
573
|
|
|
* @param string $email The email of the customer to return |
574
|
|
|
* @param string $websiteId The website ID of the customer to return |
575
|
|
|
* |
576
|
|
|
* @return array|null The customer |
577
|
|
|
*/ |
578
|
|
|
public function loadCustomerByEmailAndWebsiteId($email, $websiteId) |
579
|
|
|
{ |
580
|
|
|
return $this->getCustomerRepository()->findOneByEmailAndWebsiteId($email, $websiteId); |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* Return's the customer with the passed website ID and increment ID. |
585
|
|
|
* @param string $websiteId The website ID of the customer to return |
586
|
|
|
* @param string $incrementId The increment ID of the customer to return |
587
|
|
|
* |
588
|
|
|
* @return array|null The customer |
589
|
|
|
*/ |
590
|
|
|
public function loadCustomerByWebsiteIdAndIncrementId($websiteId, $incrementId) |
591
|
|
|
{ |
592
|
|
|
return $this->getCustomerRepository()->loadCustomerByWebsiteIdAndIncrementId($websiteId, $incrementId); |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
/** |
596
|
|
|
* @return mixed |
597
|
|
|
*/ |
598
|
|
|
public function loadDirectoryCountryRegions() |
599
|
|
|
{ |
600
|
|
|
return $this->getCustomerRepository()->findDirectoryCountryRegions(); |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
/** |
604
|
|
|
* Persist's the passed customer data and return's the ID. |
605
|
|
|
* |
606
|
|
|
* @param array $customer The customer data to persist |
607
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
608
|
|
|
* |
609
|
|
|
* @return string The ID of the persisted entity |
610
|
|
|
*/ |
611
|
|
|
public function persistCustomer($customer, $name = null) |
612
|
|
|
{ |
613
|
|
|
return $this->getCustomerAction()->persist($customer, $name); |
|
|
|
|
614
|
|
|
} |
615
|
|
|
|
616
|
|
|
/** |
617
|
|
|
* Persist's the passed customer varchar attribute. |
618
|
|
|
* |
619
|
|
|
* @param array $attribute The attribute to persist |
620
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
621
|
|
|
* |
622
|
|
|
* @return void |
623
|
|
|
*/ |
624
|
|
|
public function persistCustomerVarcharAttribute($attribute, $name = null) |
625
|
|
|
{ |
626
|
|
|
$this->getCustomerVarcharAction()->persist($attribute, $name); |
|
|
|
|
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
/** |
630
|
|
|
* Persist's the passed customer integer attribute. |
631
|
|
|
* |
632
|
|
|
* @param array $attribute The attribute to persist |
633
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
634
|
|
|
* |
635
|
|
|
* @return void |
636
|
|
|
*/ |
637
|
|
|
public function persistCustomerIntAttribute($attribute, $name = null) |
638
|
|
|
{ |
639
|
|
|
$this->getCustomerIntAction()->persist($attribute, $name); |
|
|
|
|
640
|
|
|
} |
641
|
|
|
|
642
|
|
|
/** |
643
|
|
|
* Persist's the passed customer decimal attribute. |
644
|
|
|
* |
645
|
|
|
* @param array $attribute The attribute to persist |
646
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
647
|
|
|
* |
648
|
|
|
* @return void |
649
|
|
|
*/ |
650
|
|
|
public function persistCustomerDecimalAttribute($attribute, $name = null) |
651
|
|
|
{ |
652
|
|
|
$this->getCustomerDecimalAction()->persist($attribute, $name); |
|
|
|
|
653
|
|
|
} |
654
|
|
|
|
655
|
|
|
/** |
656
|
|
|
* Persist's the passed customer datetime attribute. |
657
|
|
|
* |
658
|
|
|
* @param array $attribute The attribute to persist |
659
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
660
|
|
|
* |
661
|
|
|
* @return void |
662
|
|
|
*/ |
663
|
|
|
public function persistCustomerDatetimeAttribute($attribute, $name = null) |
664
|
|
|
{ |
665
|
|
|
$this->getCustomerDatetimeAction()->persist($attribute, $name); |
|
|
|
|
666
|
|
|
} |
667
|
|
|
|
668
|
|
|
/** |
669
|
|
|
* Persist's the passed customer text attribute. |
670
|
|
|
* |
671
|
|
|
* @param array $attribute The attribute to persist |
672
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
673
|
|
|
* |
674
|
|
|
* @return void |
675
|
|
|
*/ |
676
|
|
|
public function persistCustomerTextAttribute($attribute, $name = null) |
677
|
|
|
{ |
678
|
|
|
$this->getCustomerTextAction()->persist($attribute, $name); |
|
|
|
|
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* Delete's the entity with the passed attributes. |
683
|
|
|
* |
684
|
|
|
* @param array $row The attributes of the entity to delete |
685
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
686
|
|
|
* |
687
|
|
|
* @return void |
688
|
|
|
*/ |
689
|
|
|
public function deleteCustomer($row, $name = null) |
690
|
|
|
{ |
691
|
|
|
$this->getCustomerAction()->delete($row, $name); |
|
|
|
|
692
|
|
|
} |
693
|
|
|
|
694
|
|
|
/** |
695
|
|
|
* Delete's the customer datetime attribute with the passed attributes. |
696
|
|
|
* |
697
|
|
|
* @param array $row The attributes of the entity to delete |
698
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
699
|
|
|
* |
700
|
|
|
* @return void |
701
|
|
|
*/ |
702
|
|
|
public function deleteCustomerDatetimeAttribute($row, $name = null) |
703
|
|
|
{ |
704
|
|
|
$this->getCustomerDatetimeAction()->delete($row, $name); |
|
|
|
|
705
|
|
|
} |
706
|
|
|
|
707
|
|
|
/** |
708
|
|
|
* Delete's the customer decimal attribute with the passed attributes. |
709
|
|
|
* |
710
|
|
|
* @param array $row The attributes of the entity to delete |
711
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
712
|
|
|
* |
713
|
|
|
* @return void |
714
|
|
|
*/ |
715
|
|
|
public function deleteCustomerDecimalAttribute($row, $name = null) |
716
|
|
|
{ |
717
|
|
|
$this->getCustomerDecimalAction()->delete($row, $name); |
|
|
|
|
718
|
|
|
} |
719
|
|
|
|
720
|
|
|
/** |
721
|
|
|
* Delete's the customer integer attribute with the passed attributes. |
722
|
|
|
* |
723
|
|
|
* @param array $row The attributes of the entity to delete |
724
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
725
|
|
|
* |
726
|
|
|
* @return void |
727
|
|
|
*/ |
728
|
|
|
public function deleteCustomerIntAttribute($row, $name = null) |
729
|
|
|
{ |
730
|
|
|
$this->getCustomerIntAction()->delete($row, $name); |
|
|
|
|
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* Delete's the customer text attribute with the passed attributes. |
735
|
|
|
* |
736
|
|
|
* @param array $row The attributes of the entity to delete |
737
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
738
|
|
|
* |
739
|
|
|
* @return void |
740
|
|
|
*/ |
741
|
|
|
public function deleteCustomerTextAttribute($row, $name = null) |
742
|
|
|
{ |
743
|
|
|
$this->getCustomerTextAction()->delete($row, $name); |
|
|
|
|
744
|
|
|
} |
745
|
|
|
|
746
|
|
|
/** |
747
|
|
|
* Delete's the customer varchar attribute with the passed attributes. |
748
|
|
|
* |
749
|
|
|
* @param array $row The attributes of the entity to delete |
750
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
751
|
|
|
* |
752
|
|
|
* @return void |
753
|
|
|
*/ |
754
|
|
|
public function deleteCustomerVarcharAttribute($row, $name = null) |
755
|
|
|
{ |
756
|
|
|
$this->getCustomerVarcharAction()->delete($row, $name); |
|
|
|
|
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* Clean-Up the repositories to free memory. |
761
|
|
|
* |
762
|
|
|
* @return void |
763
|
|
|
*/ |
764
|
|
|
public function cleanUp() |
765
|
|
|
{ |
766
|
|
|
// flush the cache |
767
|
|
|
} |
768
|
|
|
} |
769
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.