@@ -55,14 +55,13 @@ Instead, GraphQLite offers an easier to implement solution: the ability to fetch
5555#[Type]
5656class PostType {
5757 /**
58- * @param Post $post
5958 * @param mixed $prefetchedUsers
6059 * @return User
6160 */
6261 #[Field]
63- public function getUser(Post $post, #[Prefetch("prefetchUsers")] $prefetchedUsers): User
62+ public function getUser(#[Prefetch("prefetchUsers")] $prefetchedUsers): User
6463 {
65- // This method will receive the $prefetchedUsers as second argument. This is the return value of the "prefetchUsers" method below.
64+ // This method will receive the $prefetchedUsers as first argument. This is the return value of the "prefetchUsers" method below.
6665 // Using this prefetched list, it should be easy to map it to the post
6766 }
6867
@@ -91,13 +90,12 @@ class PostType {
9190class PostType {
9291 /**
9392 * @Field(prefetchMethod="prefetchUsers")
94- * @param Post $post
9593 * @param mixed $prefetchedUsers
9694 * @return User
9795 */
98- public function getUser(Post $post, $prefetchedUsers): User
96+ public function getUser($prefetchedUsers): User
9997 {
100- // This method will receive the $prefetchedUsers as second argument. This is the return value of the "prefetchUsers" method below.
98+ // This method will receive the $prefetchedUsers as first argument. This is the return value of the "prefetchUsers" method below.
10199 // Using this prefetched list, it should be easy to map it to the post
102100 }
103101
@@ -145,12 +143,11 @@ For instance:
145143#[Type]
146144class PostType {
147145 /**
148- * @param Post $post
149146 * @param mixed $prefetchedComments
150147 * @return Comment[]
151148 */
152149 #[Field]
153- public function getComments(Post $post, #[Prefetch("prefetchComments")] $prefetchedComments): array
150+ public function getComments(#[Prefetch("prefetchComments")] $prefetchedComments): array
154151 {
155152 // ...
156153 }
@@ -177,11 +174,10 @@ class PostType {
177174class PostType {
178175 /**
179176 * @Field(prefetchMethod="prefetchComments")
180- * @param Post $post
181177 * @param mixed $prefetchedComments
182178 * @return Comment[]
183179 */
184- public function getComments(Post $post, $prefetchedComments): array
180+ public function getComments($prefetchedComments): array
185181 {
186182 // ...
187183 }
0 commit comments