File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ class Context
22
22
// The endpoint handling the request
23
23
public ?EndpointInterface $endpoint = null;
24
24
25
+ // The query being constructed by the Index endpoint
26
+ public ?object $query = null;
27
+
25
28
// The serializer instance
26
29
public ?Serializer $serializer = null;
27
30
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class Context
12
12
{
13
13
public ?ResourceInterface $ resource = null ;
14
14
public ?EndpointInterface $ endpoint = null ;
15
+ public ?object $ query = null ;
15
16
public ?Serializer $ serializer = null ;
16
17
public mixed $ model = null ;
17
18
public ?Field $ field = null ;
@@ -138,6 +139,13 @@ public function withEndpoint(EndpointInterface $endpoint): static
138
139
return $ new ;
139
140
}
140
141
142
+ public function withQuery (object $ query ): static
143
+ {
144
+ $ new = clone $ this ;
145
+ $ new ->query = $ query ;
146
+ return $ new ;
147
+ }
148
+
141
149
public function withSerializer (Serializer $ serializer ): static
142
150
{
143
151
$ new = clone $ this ;
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ public function handle(Context $context): ?Response
82
82
83
83
$ query = $ resource ->query ($ context );
84
84
85
+ $ context = $ context ->withQuery ($ query );
86
+
85
87
$ this ->applySorts ($ query , $ context );
86
88
$ this ->applyFilters ($ query , $ context );
87
89
You can’t perform that action at this time.
0 commit comments