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-catalog-graph-ql
Model
Resolver
Product
EntityIdToId.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\CatalogGraphQl\Model\Resolver\Product
;
9
10
use
Magento\Framework\GraphQl\Exception\GraphQlInputException
;
11
use
Magento\Framework\GraphQl\Schema\Type\ResolveInfo
;
12
use
Magento\Catalog\Api\Data\ProductInterface
;
13
use
Magento\Catalog\Model\Product
;
14
use
Magento\Framework\EntityManager\MetadataPool
;
15
use
Magento\Framework\GraphQl\Config\Element\Field
;
16
use
Magento\Framework\GraphQl\Query\ResolverInterface
;
17
23
class
EntityIdToId
implements
ResolverInterface
24
{
28
private
$metadataPool;
29
33
public
function
__construct
(
MetadataPool
$metadataPool)
34
{
35
$this->metadataPool = $metadataPool;
36
}
37
41
public
function
resolve
(
42
Field
$field,
43
$context,
44
ResolveInfo
$info
,
45
array
$value
=
null
,
46
array $args =
null
47
) {
48
if
(!isset(
$value
[
'model'
])) {
49
throw
new
GraphQlInputException
(
__
(
'"model" value should be specified'
));
50
}
51
53
$product
=
$value
[
'model'
];
54
55
$productId
=
$product
->getData(
56
$this->metadataPool->getMetadata(ProductInterface::class)->getLinkField()
57
);
58
59
return
$productId
;
60
}
61
}
Magento\Framework\GraphQl\Query\ResolverInterface
Definition:
ResolverInterface.php:18
$productId
$productId
Definition:
website_attribute_sync.php:26
Magento\Framework\GraphQl\Schema\Type\ResolveInfo
Definition:
ResolveInfo.php:13
Magento\CatalogGraphQl\Model\Resolver\Product\EntityIdToId
Definition:
EntityIdToId.php:23
__
__()
Definition:
__.php:13
Magento\Framework\GraphQl\Config\Element\Field
Definition:
Field.php:15
Magento\Framework\EntityManager\MetadataPool
Definition:
MetadataPool.php:18
$value
$value
Definition:
gender.phtml:16
Magento\CatalogGraphQl\Model\Resolver\Product\EntityIdToId\__construct
__construct(MetadataPool $metadataPool)
Definition:
EntityIdToId.php:33
Magento\CatalogGraphQl\Model\Resolver\Product
Definition:
CanonicalUrl.php:8
Magento\Catalog\Model\Product
Definition:
ActionTest.php:6
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$info
foreach( $_productCollection as $_product)() ?>" class $info
Definition:
listing.phtml:52
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14
Magento\Framework\GraphQl\Query\ResolverInterface\resolve
resolve(Field $field, $context, ResolveInfo $info, array $value=null, array $args=null)
Magento\Framework\GraphQl\Exception\GraphQlInputException
Definition:
GraphQlInputException.php:16