@@ -55,14 +55,13 @@ Instead, GraphQLite offers an easier to implement solution: the ability to fetch
55
55
#[Type]
56
56
class PostType {
57
57
/**
58
- * @param Post $post
59
58
* @param mixed $prefetchedUsers
60
59
* @return User
61
60
*/
62
61
#[Field]
63
- public function getUser(Post $post, #[Prefetch("prefetchUsers")] $prefetchedUsers): User
62
+ public function getUser(#[Prefetch("prefetchUsers")] $prefetchedUsers): User
64
63
{
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.
66
65
// Using this prefetched list, it should be easy to map it to the post
67
66
}
68
67
@@ -91,13 +90,12 @@ class PostType {
91
90
class PostType {
92
91
/**
93
92
* @Field(prefetchMethod="prefetchUsers")
94
- * @param Post $post
95
93
* @param mixed $prefetchedUsers
96
94
* @return User
97
95
*/
98
- public function getUser(Post $post, $prefetchedUsers): User
96
+ public function getUser($prefetchedUsers): User
99
97
{
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.
101
99
// Using this prefetched list, it should be easy to map it to the post
102
100
}
103
101
@@ -145,12 +143,11 @@ For instance:
145
143
#[Type]
146
144
class PostType {
147
145
/**
148
- * @param Post $post
149
146
* @param mixed $prefetchedComments
150
147
* @return Comment[]
151
148
*/
152
149
#[Field]
153
- public function getComments(Post $post, #[Prefetch("prefetchComments")] $prefetchedComments): array
150
+ public function getComments(#[Prefetch("prefetchComments")] $prefetchedComments): array
154
151
{
155
152
// ...
156
153
}
@@ -177,11 +174,10 @@ class PostType {
177
174
class PostType {
178
175
/**
179
176
* @Field(prefetchMethod="prefetchComments")
180
- * @param Post $post
181
177
* @param mixed $prefetchedComments
182
178
* @return Comment[]
183
179
*/
184
- public function getComments(Post $post, $prefetchedComments): array
180
+ public function getComments($prefetchedComments): array
185
181
{
186
182
// ...
187
183
}
0 commit comments