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-cms-graph-ql
Model
Resolver
Page.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\CmsGraphQl\Model\Resolver
;
9
10
use
Magento\CmsGraphQl\Model\Resolver\DataProvider\Page
as PageDataProvider;
11
use
Magento\Framework\Exception\NoSuchEntityException
;
12
use
Magento\Framework\GraphQl\Config\Element\Field
;
13
use
Magento\Framework\GraphQl\Exception\GraphQlInputException
;
14
use
Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException
;
15
use
Magento\Framework\GraphQl\Query\ResolverInterface
;
16
use
Magento\Framework\GraphQl\Schema\Type\ResolveInfo
;
17
21
class
Page
implements
ResolverInterface
22
{
26
private
$pageDataProvider;
27
31
public
function
__construct
(
32
PageDataProvider $pageDataProvider
33
) {
34
$this->pageDataProvider = $pageDataProvider;
35
}
36
40
public
function
resolve
(
41
Field
$field,
42
$context,
43
ResolveInfo
$info
,
44
array
$value
=
null
,
45
array $args =
null
46
) {
47
$pageId = $this->getPageId($args);
48
$pageData = $this->getPageData($pageId);
49
50
return
$pageData;
51
}
52
58
private
function
getPageId(array $args): int
59
{
60
if
(!isset($args[
'id'
])) {
61
throw
new
GraphQlInputException
(
__
(
'"Page id should be specified'
));
62
}
63
64
return
(
int
)$args[
'id'
];
65
}
66
72
private
function
getPageData(
int
$pageId): array
73
{
74
try
{
75
$pageData = $this->pageDataProvider->getData($pageId);
76
}
catch
(NoSuchEntityException $e) {
77
throw
new
GraphQlNoSuchEntityException(
__
($e->getMessage()), $e);
78
}
79
return
$pageData;
80
}
81
}
Magento\CmsGraphQl\Model\Resolver\Page\resolve
resolve(Field $field, $context, ResolveInfo $info, array $value=null, array $args=null)
Definition:
Page.php:40
Magento\Framework\GraphQl\Query\ResolverInterface
Definition:
ResolverInterface.php:18
Magento\Framework\GraphQl\Schema\Type\ResolveInfo
Definition:
ResolveInfo.php:13
__
__()
Definition:
__.php:13
Magento\CmsGraphQl\Model\Resolver\DataProvider\Page
Definition:
Page.php:18
Magento\Framework\GraphQl\Config\Element\Field
Definition:
Field.php:15
Magento\CmsGraphQl\Model\Resolver
Definition:
Blocks.php:8
Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException
Definition:
GraphQlNoSuchEntityException.php:16
$value
$value
Definition:
gender.phtml:16
Magento\CmsGraphQl\Model\Resolver\Page\__construct
__construct(PageDataProvider $pageDataProvider)
Definition:
Page.php:31
$info
foreach( $_productCollection as $_product)() ?>" class $info
Definition:
listing.phtml:52
Magento\CmsGraphQl\Model\Resolver\Page
Definition:
Page.php:21
Magento\Framework\GraphQl\Exception\GraphQlInputException
Definition:
GraphQlInputException.php:16
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16