This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree 2 files changed +7
-16
lines changed
app/code/Magento/CmsGraphQl/Model/Resolver
2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 11
11
use Magento \Cms \Api \PageRepositoryInterface as CmsPageRepositoryInterface ;
12
12
use Magento \Framework \Exception \LocalizedException ;
13
13
use Magento \Framework \Exception \NoSuchEntityException ;
14
- use Magento \Framework \Serialize \SerializerInterface ;
15
- use Magento \Framework \Webapi \ServiceOutputProcessor ;
16
14
17
15
/**
18
16
* Cms field data provider, used for GraphQL request processing.
@@ -38,7 +36,7 @@ public function __construct(
38
36
*
39
37
* @param int $cmsPageId
40
38
* @return array
41
- * @throws NoSuchEntityException| LocalizedException
39
+ * @throws LocalizedException
42
40
*/
43
41
public function getCmsPageById (int $ cmsPageId ) : array
44
42
{
@@ -78,4 +76,4 @@ private function processCmsPage(CmsPageInterface $cmsPageModel) : array
78
76
79
77
return $ cmsPageData ;
80
78
}
81
- }
79
+ }
Original file line number Diff line number Diff line change 8
8
namespace Magento \CmsGraphQl \Model \Resolver ;
9
9
10
10
use Magento \CmsGraphQl \Model \Resolver \Cms \CmsPageDataProvider ;
11
- use Magento \Framework \Exception \NoSuchEntityException ;
12
11
use Magento \Framework \GraphQl \Config \Element \Field ;
13
12
use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
14
- use Magento \Framework \GraphQl \Exception \GraphQlNoSuchEntityException ;
15
13
use Magento \Framework \GraphQl \Query \Resolver \Value ;
16
14
use Magento \Framework \GraphQl \Query \Resolver \ValueFactory ;
17
15
use Magento \Framework \GraphQl \Query \ResolverInterface ;
@@ -56,18 +54,13 @@ public function resolve(
56
54
) : Value {
57
55
58
56
$ cmsPageId = $ this ->getCmsPageId ($ args );
57
+ $ cmsPageData = $ this ->cmsPageDataProvider ->getCmsPageById ($ cmsPageId );
59
58
60
- try {
61
- $ cmsPageData = $ this ->cmsPageDataProvider ->getCmsPageById ($ cmsPageId );
59
+ $ result = function () use ($ cmsPageData ) {
60
+ return !empty ($ cmsPageData ) ? $ cmsPageData : [];
61
+ };
62
62
63
- $ result = function () use ($ cmsPageData ) {
64
- return !empty ($ cmsPageData ) ? $ cmsPageData : [];
65
- };
66
-
67
- return $ this ->valueFactory ->create ($ result );
68
- } catch (NoSuchEntityException $ exception ) {
69
- throw new GraphQlNoSuchEntityException (__ ('CMS page with ID %1 does not exist. ' , [$ cmsPageId ]));
70
- }
63
+ return $ this ->valueFactory ->create ($ result );
71
64
}
72
65
73
66
/**
You can’t perform that action at this time.
0 commit comments