1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Customer\Subjects\BunchSubject |
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\Subjects; |
16
|
|
|
|
17
|
|
|
use TechDivision\Import\Subjects\ExportableTrait; |
18
|
|
|
use TechDivision\Import\Subjects\ExportableSubjectInterface; |
19
|
|
|
use TechDivision\Import\Customer\Utils\RegistryKeys; |
20
|
|
|
use TechDivision\Import\Utils\EntityTypeCodes; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The subject implementation that handles the business logic to persist customers. |
24
|
|
|
* |
25
|
|
|
* @author Tim Wagner <[email protected]> |
26
|
|
|
* @copyright 2018 TechDivision GmbH <[email protected]> |
27
|
|
|
* @license https://opensource.org/licenses/MIT |
28
|
|
|
* @link https://github.com/techdivision/import-customer |
29
|
|
|
* @link http://www.techdivision.com |
30
|
|
|
*/ |
31
|
|
|
class BunchSubject extends AbstractCustomerSubject implements ExportableSubjectInterface |
32
|
|
|
{ |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The trait that implements the export functionality. |
36
|
|
|
* |
37
|
|
|
* @var \TechDivision\Import\Subjects\ExportableTrait |
38
|
|
|
*/ |
39
|
|
|
use ExportableTrait; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* The array with the pre-loaded entity IDs. |
43
|
|
|
* |
44
|
|
|
* @var array |
45
|
|
|
*/ |
46
|
|
|
protected $preLoadedEntityIds = array(); |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Mapping for the virtual entity type code to the real Magento 2 EAV entity type code. |
50
|
|
|
* |
51
|
|
|
* @var array |
52
|
|
|
*/ |
53
|
|
|
protected $entityTypeCodeMappings = array( |
54
|
|
|
EntityTypeCodes::CUSTOMER => EntityTypeCodes::CUSTOMER, |
55
|
|
|
); |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Clean up the global data after importing the bunch. |
59
|
|
|
* |
60
|
|
|
* @param string $serial The serial of the actual import |
61
|
|
|
* |
62
|
|
|
* @return void |
63
|
|
|
*/ |
64
|
|
|
public function tearDown($serial) |
65
|
|
|
{ |
66
|
|
|
|
67
|
|
|
// invoke the parent method |
68
|
|
|
parent::tearDown($serial); |
69
|
|
|
|
70
|
|
|
// load the registry processor |
71
|
|
|
$registryProcessor = $this->getRegistryProcessor(); |
72
|
|
|
|
73
|
|
|
// update the status |
74
|
|
|
$registryProcessor->mergeAttributesRecursive( |
75
|
|
|
RegistryKeys::STATUS, |
76
|
|
|
array( |
77
|
|
|
RegistryKeys::PRE_LOADED_ENTITY_IDS => $this->preLoadedEntityIds, |
78
|
|
|
) |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|