Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Customer
_files
five_repository_customers.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Customer\Api\CustomerRepositoryInterface
;
9
use
Magento\Customer\Api\Data\CustomerInterface
;
10
use Magento\Customer\Api\Data\CustomerInterfaceFactory;
11
use
Magento\Customer\Model\Customer
;
12
use
Magento\Eav\Model\Config
as EavModelConfig;
13
use
Magento\Framework\Indexer\IndexerInterface
;
14
use
Magento\Framework\Indexer\IndexerRegistry
;
15
use
Magento\TestFramework\Helper\Bootstrap
;
16
17
$objectManager
= Bootstrap::getObjectManager();
18
20
$customerRepository
=
$objectManager
->create(CustomerRepositoryInterface::class);
22
$customerFactory
=
$objectManager
->get(CustomerInterfaceFactory::class);
23
24
for
(
$i
= 1;
$i
<= 5;
$i
++) {
26
$customer
=
$customerFactory
->create();
27
$customer
->setFirstname(
'John'
)
28
->setGroupId(1)
29
->setLastname(
'Smith'
)
30
->setWebsiteId(1)
31
->setEmail(
'customer'
.
$i
.
'@example.com'
);
32
try
{
33
$customerRepository
->save(
$customer
,
'password'
);
34
}
catch
(\Exception $e) {
35
}
36
}
37
39
$eavConfig
=
$objectManager
->get(EavModelConfig::class);
40
$eavConfig
->clear();
41
43
$indexerRegistry
=
$objectManager
->create(IndexerRegistry::class);
45
$indexer
=
$indexerRegistry
->get(Customer::CUSTOMER_GRID_INDEXER_ID);
46
try
{
47
$indexer
->reindexAll();
48
}
catch
(\Exception $e) {
49
}
$objectManager
$objectManager
Definition:
five_repository_customers.php:17
$customer
$customer
Definition:
customers.php:11
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$indexerRegistry
$indexerRegistry
Definition:
five_repository_customers.php:43
$customerFactory
$customerFactory
Definition:
five_repository_customers.php:22
$eavConfig
$eavConfig
Definition:
five_repository_customers.php:39
$indexer
$indexer
Definition:
five_repository_customers.php:45
Magento\Customer\Api\CustomerRepositoryInterface
Definition:
CustomerRepositoryInterface.php:15
Magento\Customer\Model\Customer
Magento\Framework\Indexer\IndexerRegistry
Definition:
IndexerRegistry.php:12
Magento\Customer\Api\Data\CustomerInterface
Definition:
CustomerInterface.php:13
Magento\Framework\Indexer\IndexerInterface
Definition:
IndexerInterface.php:16
Magento\Eav\Model\Config
Definition:
Config.php:18
$i
$i
Definition:
gallery.phtml:31
$customerRepository
$customerRepository
Definition:
five_repository_customers.php:20