21 private $addressDataGenerator;
26 private $groupCollectionFactory;
31 private $customerGroupIds;
40 \
Magento\
Setup\Model\Address\AddressDataGenerator $addressDataGenerator,
43 $this->groupCollectionFactory = $groupCollectionFactory;
44 $this->addressDataGenerator = $addressDataGenerator;
59 'group_id' => $this->getGroupIdForCustomer(
$customerId)
62 'addresses' => $this->generateAddresses(),
73 if (!$this->customerGroupIds) {
74 $this->customerGroupIds = $this->groupCollectionFactory->create()->getAllIds();
77 return $this->customerGroupIds[
$customerId % count($this->customerGroupIds)];
87 private function generateAddresses()
90 $addressesCount = $this->config[
'addresses-count'];
92 while ($addressesCount) {
93 $addresses[] = $this->addressDataGenerator->generateAddress();
__construct(\Magento\Customer\Model\ResourceModel\Group\CollectionFactory $groupCollectionFactory, \Magento\Setup\Model\Address\AddressDataGenerator $addressDataGenerator, array $config)