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