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
module-elasticsearch
Model
Adapter
BatchDataMapper
DataMapperFactory.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Elasticsearch\Model\Adapter\BatchDataMapper
;
7
8
use
Magento\Framework\ObjectManagerInterface
;
9
use
Magento\Framework\Exception\NoSuchEntityException
;
10
use
Magento\Framework\Exception\ConfigurationMismatchException
;
11
use
Magento\Elasticsearch\Model\Adapter\BatchDataMapperInterface
;
12
16
class
DataMapperFactory
17
{
23
private
$objectManager;
24
28
private
$dataMappers;
29
34
public
function
__construct
(
35
ObjectManagerInterface
$objectManager,
36
array $dataMappers = []
37
) {
38
$this->objectManager =
$objectManager
;
39
$this->dataMappers = $dataMappers;
40
}
41
50
public
function
create
(
$entityType
)
51
{
52
if
(!isset($this->dataMappers[
$entityType
])) {
53
throw
new
NoSuchEntityException
(
54
__
(
55
'There is no such data mapper "%1" for interface %2'
,
56
$entityType
,
57
BatchDataMapperInterface::class
58
)
59
);
60
}
61
$dataMapperClass = $this->dataMappers[
$entityType
];
62
$dataMapperEntity = $this->objectManager->create($dataMapperClass);
63
if
(!$dataMapperEntity instanceof
BatchDataMapperInterface
) {
64
throw
new
ConfigurationMismatchException
(
65
__
(
66
'Data mapper "%1" must implement interface %2'
,
67
$dataMapperClass,
68
BatchDataMapperInterface::class
69
)
70
);
71
}
72
73
return
$dataMapperEntity;
74
}
75
}
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
__
__()
Definition:
__.php:13
$entityType
$entityType
Definition:
attribute_set_with_image_attribute.php:13
Magento\Elasticsearch\Model\Adapter\BatchDataMapper\DataMapperFactory\create
create($entityType)
Definition:
DataMapperFactory.php:50
Magento\Elasticsearch\Model\Adapter\BatchDataMapper
Definition:
CategoryFieldsProvider.php:7
Magento\Elasticsearch\Model\Adapter\BatchDataMapper\DataMapperFactory\__construct
__construct(ObjectManagerInterface $objectManager, array $dataMappers=[])
Definition:
DataMapperFactory.php:34
Magento\Elasticsearch\Model\Adapter\BatchDataMapper\DataMapperFactory
Definition:
DataMapperFactory.php:16
Magento\Framework\Exception\ConfigurationMismatchException
Definition:
ConfigurationMismatchException.php:13
Magento\Elasticsearch\Model\Adapter\BatchDataMapperInterface
Definition:
BatchDataMapperInterface.php:14
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16