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
GraphQl
Config
Element
EnumFactory.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\Framework\GraphQl\Config\Element
;
9
10
use
Magento\Framework\GraphQl\Config\ConfigElementFactoryInterface
;
11
use
Magento\Framework\GraphQl\Config\ConfigElementInterface
;
12
use
Magento\Framework\ObjectManagerInterface
;
13
17
class
EnumFactory
implements
ConfigElementFactoryInterface
18
{
22
private
$objectManager;
23
27
private
$enumValueFactory;
28
33
public
function
__construct
(
34
ObjectManagerInterface
$objectManager,
35
EnumValueFactory
$enumValueFactory
36
) {
37
$this->objectManager =
$objectManager
;
38
$this->enumValueFactory = $enumValueFactory;
39
}
40
49
public
function
create
(
string
$name
, array
$values
,
string
$description
=
''
):
Enum
50
{
51
return
$this->objectManager->create(
52
Enum::class,
53
[
54
'name'
=>
$name
,
55
'values'
=>
$values
,
56
'description'
=>
$description
57
]
58
);
59
}
60
67
public
function
createFromConfigData
(array
$data
):
ConfigElementInterface
68
{
69
$values
= [];
70
foreach
(
$data
[
'items'
] as
$item
) {
71
$values
[
$item
[
'_value'
]] = $this->enumValueFactory->create(
72
$item
[
'name'
],
73
$item
[
'_value'
],
74
isset(
$item
[
'description'
]) ?
$item
[
'description'
] :
''
75
);
76
}
77
return
$this->
create
(
78
$data[
'name'
],
79
$values
,
80
isset(
$data
[
'description'
]) ?
$data
[
'description'
] :
''
81
);
82
}
83
}
$description
$description
Definition:
pre_composer_update_2.3.php:162
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Framework\GraphQl\Config\Element\EnumValueFactory
Definition:
EnumValueFactory.php:15
$values
$values
Definition:
options.phtml:88
$item
$item
Definition:
partial_invoice.php:27
Magento\Framework\GraphQl\Config\ConfigElementInterface
Definition:
ConfigElementInterface.php:13
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\GraphQl\Config\ConfigElementFactoryInterface
Definition:
ConfigElementFactoryInterface.php:13
Magento\Framework\GraphQl\Config\Element\EnumFactory\create
create(string $name, array $values, string $description='')
Definition:
EnumFactory.php:49
Magento\Framework\GraphQl\Config\Element\Enum
Definition:
Enum.php:15
Magento\Framework\GraphQl\Config\Element
Definition:
Argument.php:8
Magento\Framework\GraphQl\Config\Element\EnumFactory
Definition:
EnumFactory.php:17
Magento\Framework\GraphQl\Config\Element\EnumFactory\createFromConfigData
createFromConfigData(array $data)
Definition:
EnumFactory.php:67
Magento\Framework\GraphQl\Config\Element\EnumFactory\__construct
__construct(ObjectManagerInterface $objectManager, EnumValueFactory $enumValueFactory)
Definition:
EnumFactory.php:33
$name
if(!isset($_GET['name'])) $name
Definition:
log.php:14