File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed
Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,16 @@ public function resolve(
4444 array $ value = null ,
4545 array $ args = null
4646 ) {
47- $ fields = $ info ->getFieldSelection ();
4847 $ postId = $ this ->getPostId ($ args );
49- return $ this ->getPostData ($ postId , $ fields );
48+ $ fields = $ info ? $ info ->getFieldSelection (10 ) : null ;
49+
50+ try {
51+ $ postData = $ this ->postDataProvider ->getData ($ postId , $ fields );
52+ } catch (NoSuchEntityException $ e ) {
53+ throw new GraphQlNoSuchEntityException (__ ($ e ->getMessage ()), $ e );
54+ }
55+
56+ return $ postData ;
5057 }
5158
5259 /**
@@ -62,20 +69,4 @@ private function getPostId(array $args): string
6269
6370 return (string )$ args ['id ' ];
6471 }
65-
66- /**
67- * @param string $postId
68- * @param array $fields
69- * @return array
70- * @throws GraphQlNoSuchEntityException
71- */
72- private function getPostData (string $ postId , array $ fields ): array
73- {
74- try {
75- $ postData = $ this ->postDataProvider ->getData ($ postId , $ fields );
76- } catch (NoSuchEntityException $ e ) {
77- throw new GraphQlNoSuchEntityException (__ ($ e ->getMessage ()), $ e );
78- }
79- return $ postData ;
80- }
8172}
You can’t perform that action at this time.
0 commit comments