9 use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory;
51 private $customerGenerator;
56 private $customerDataGeneratorFactory;
61 private $defaultCustomerConfig = [
62 'addresses-count' => 2
68 private $collectionFactory;
80 CollectionFactory $collectionFactory
84 $this->customerGenerator = $customerGenerator;
85 $this->customerDataGeneratorFactory = $customerDataGeneratorFactory;
86 $this->collectionFactory = $collectionFactory;
94 $customersNumber = $this->getCustomersAmount();
95 if (!$customersNumber) {
100 $customerDataGenerator = $this->customerDataGeneratorFactory->create(
101 $this->getCustomersConfig()
105 'customer_data' =>
function (
$customerId) use ($customerDataGenerator) {
106 return $customerDataGenerator->generate(
$customerId);
110 $this->customerGenerator->generate($customersNumber, $fixtureMap);
116 private function getCustomersAmount()
118 return max(0, $this->fixtureModel->getValue(
'customers', 0) - $this->collectionFactory->create()->getSize());
126 return 'Generating customers';
135 'customers' =>
'Customers' 142 private function getCustomersConfig()
144 return $this->fixtureModel->getValue(
'customer-config', $this->defaultCustomerConfig);
__construct(FixtureModel $fixtureModel, CustomerGenerator $customerGenerator, CustomerDataGeneratorFactory $customerDataGeneratorFactory, CollectionFactory $collectionFactory)