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
framework
EntityManager
Mapper.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\EntityManager
;
7
11
class
Mapper
implements
MapperInterface
12
{
16
private
$config;
17
23
public
function
__construct
(
24
$config = []
25
) {
26
$this->config = $config;
27
}
28
32
public
function
entityToDatabase
(
$entityType
,
$data
)
33
{
34
if
(isset($this->config[
$entityType
])) {
35
foreach
($this->config[
$entityType
] as $databaseFieldName => $entityFieldName) {
36
if
(!$entityFieldName) {
37
throw
new \LogicException(
'Incorrect configuration for '
.
$entityType
);
38
}
39
if
(isset(
$data
[$entityFieldName])) {
40
$data
[$databaseFieldName] =
$data
[$entityFieldName];
41
unset(
$data
[$entityFieldName]);
42
}
43
}
44
}
45
return
$data
;
46
}
47
51
public
function
databaseToEntity
(
$entityType
,
$data
)
52
{
53
if
(isset($this->config[
$entityType
])) {
54
foreach
($this->config[
$entityType
] as $databaseFieldName => $entityFieldName) {
55
if
(!$entityFieldName) {
56
throw
new \LogicException(
'Incorrect configuration for '
.
$entityType
);
57
}
58
if
(isset(
$data
[$databaseFieldName])) {
59
$data
[$entityFieldName] =
$data
[$databaseFieldName];
60
unset(
$data
[$databaseFieldName]);
61
}
62
}
63
}
64
return
$data
;
65
}
66
}
Magento\Framework\EntityManager\Mapper\entityToDatabase
entityToDatabase($entityType, $data)
Definition:
Mapper.php:32
Magento\Framework\EntityManager\Mapper\databaseToEntity
databaseToEntity($entityType, $data)
Definition:
Mapper.php:51
$entityType
$entityType
Definition:
attribute_set_with_image_attribute.php:13
Magento\Framework\EntityManager
Definition:
AbstractModelHydrator.php:6
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\EntityManager\Mapper
Definition:
Mapper.php:11
Magento\Framework\EntityManager\Mapper\__construct
__construct( $config=[])
Definition:
Mapper.php:23
Magento\Framework\EntityManager\MapperInterface
Definition:
MapperInterface.php:11