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-eav
Model
ResourceModel
Config.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Eav\Model\ResourceModel
;
7
13
class
Config
extends
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
14
{
20
protected
static
$_entityTypes
= [];
21
27
protected
static
$_attributes
= [];
28
35
protected
function
_construct
()
36
{
37
$this->
_init
(
'eav_entity_type'
,
'entity_type_id'
);
38
}
39
45
protected
function
_loadTypes
()
46
{
47
$connection
= $this->
getConnection
();
48
if
(!
$connection
) {
49
return
$this;
50
}
51
if
(empty(self::$_entityTypes)) {
52
$select
=
$connection
->select()->from($this->
getMainTable
());
53
$data
=
$connection
->fetchAll(
$select
);
54
foreach
(
$data
as
$row
) {
55
self::$_entityTypes[
'by_id'
][
$row
[
'entity_type_id'
]] =
$row
;
56
self::$_entityTypes[
'by_code'
][
$row
[
'entity_type_code'
]] =
$row
;
57
}
58
}
59
60
return
$this;
61
}
62
69
protected
function
_loadTypeAttributes
($typeId)
70
{
71
if
(!isset(
self::$_attributes
[$typeId])) {
72
$connection
= $this->
getConnection
();
73
$bind = [
'entity_type_id'
=> $typeId];
74
$select
=
$connection
->select()->from(
75
$this->
getTable
(
'eav_attribute'
)
76
)->where(
77
'entity_type_id = :entity_type_id'
78
);
79
80
self::$_attributes
[$typeId] =
$connection
->fetchAll(
$select
, $bind);
81
}
82
83
return
self::$_attributes
[$typeId];
84
}
85
92
public
function
fetchEntityTypeData
(
$entityType
)
93
{
94
$this->
_loadTypes
();
95
96
if
(is_numeric(
$entityType
)) {
97
$info
= isset(
98
self::$_entityTypes[
'by_id'
][
$entityType
]
99
) ? self::$_entityTypes[
'by_id'
][
$entityType
] :
null
;
100
}
else
{
101
$info
= isset(
102
self::$_entityTypes[
'by_code'
][
$entityType
]
103
) ? self::$_entityTypes[
'by_code'
][
$entityType
] :
null
;
104
}
105
106
$data
= [];
107
if
(
$info
) {
108
$data
[
'entity'
] =
$info
;
109
$attributes
= $this->
_loadTypeAttributes
(
$info
[
'entity_type_id'
]);
110
$data
[
'attributes'
] = [];
111
foreach
(
$attributes
as
$attribute
) {
112
$data
[
'attributes'
][
$attribute
[
'attribute_id'
]] =
$attribute
;
113
$data
[
'attributes'
][
$attribute
[
'attribute_code'
]] =
$attribute
[
'attribute_id'
];
114
}
115
}
116
117
return
$data
;
118
}
119
}
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getMainTable
getMainTable()
Definition:
AbstractDb.php:264
Magento\Eav\Model\ResourceModel
Definition:
AttributeLoaderTest.php:7
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
Magento\Eav\Model\ResourceModel\Config\_construct
_construct()
Definition:
Config.php:35
Magento\Framework\Model\ResourceModel\Db\AbstractDb\_init
_init($mainTable, $idFieldName)
Definition:
AbstractDb.php:186
$entityType
$entityType
Definition:
attribute_set_with_image_attribute.php:13
Magento\Eav\Model\ResourceModel\Config\fetchEntityTypeData
fetchEntityTypeData($entityType)
Definition:
Config.php:92
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getTable
getTable($tableName)
Definition:
AbstractDb.php:279
$attributes
$attributes
Definition:
matrix.phtml:13
Magento\Eav\Model\ResourceModel\Config\$_entityTypes
static $_entityTypes
Definition:
Config.php:20
Magento\Framework\Model\ResourceModel\Db\AbstractDb
Definition:
AbstractDb.php:24
Magento\Eav\Model\ResourceModel\Config\_loadTypes
_loadTypes()
Definition:
Config.php:45
Magento\Framework\App\ResourceConnection\Config
Definition:
Config.php:14
$info
foreach( $_productCollection as $_product)() ?>" class $info
Definition:
listing.phtml:52
$connection
$connection
Definition:
bulk.php:13
$_attributes
$_attributes
Definition:
configurable.phtml:13
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getConnection
getConnection()
Definition:
AbstractDb.php:325
$row
$row
Definition:
cart_rule_free_shipping.php:12
Magento\Eav\Model\ResourceModel\Config\$_attributes
static $_attributes
Definition:
Config.php:27
Magento\Eav\Model\ResourceModel\Config\_loadTypeAttributes
_loadTypeAttributes($typeId)
Definition:
Config.php:69