8
8
use Magento \Customer \Model \ResourceModel \Address \CollectionFactory as AddressCollectionFactory ;
9
9
use Magento \Framework \DataObject ;
10
10
use Magento \Framework \DB \Select ;
11
+ use Magento \ImportExport \Model \Import \AbstractEntity ;
11
12
use Magento \ImportExport \Model \ResourceModel \CollectionByPagesIterator as CollectionIterator ;
12
13
use Magento \Customer \Model \ResourceModel \Address \Collection as AddressCollection ;
14
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
13
15
14
16
/**
15
17
* Storage to check existing addresses.
@@ -35,16 +37,24 @@ class Storage
35
37
*/
36
38
protected $ collectionIterator ;
37
39
40
+ /**
41
+ * @var ScopeConfigInterface
42
+ */
43
+ private $ config ;
44
+
38
45
/**
39
46
* @param AddressCollectionFactory $addressCollectionFactory
40
47
* @param CollectionIterator $byPagesIterator
48
+ * @param ScopeConfigInterface $config
41
49
*/
42
50
public function __construct (
43
51
AddressCollectionFactory $ addressCollectionFactory ,
44
- CollectionIterator $ byPagesIterator
52
+ CollectionIterator $ byPagesIterator ,
53
+ ScopeConfigInterface $ config
45
54
) {
46
55
$ this ->addressCollectionFactory = $ addressCollectionFactory ;
47
56
$ this ->collectionIterator = $ byPagesIterator ;
57
+ $ this ->config = $ config ;
48
58
}
49
59
50
60
/**
@@ -89,7 +99,7 @@ private function loadAddresses(array $customerIds)
89
99
90
100
$ this ->collectionIterator ->iterate (
91
101
$ collection ,
92
- 5000 ,
102
+ $ this -> config -> getValue (AbstractEntity:: XML_PATH_PAGE_SIZE ) ,
93
103
[
94
104
function (DataObject $ record ) {
95
105
$ this ->addRecord ($ record ->getParentId (), $ record ->getId ());
0 commit comments