File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,29 @@ To supply the source explicitely, you can use parameter attributes:
8080* ` #[Stream] ` will pass an ` io.streams.InputStream ` instance to stream the request body to the parameter
8181* ` #[Request] ` will pass the complete ` web.Request ` object
8282
83+ Matrix parameters
84+ -----------------
85+
86+ This library supports parameters inside path segments, e.g. ` https://example.com/api/trainings/status=COMPLETED;orgunits=A,B/authors ` :
87+
88+ ``` php
89+ use web\rest\{Resource, Get, Matrix};
90+
91+ #[Resource('/api/trainings')]
92+ class Trainings {
93+
94+ #[Get('/{filter}/authors')]
95+ public function authors(#[Matrix] array $filter) {
96+ $authors= [];
97+ foreach ($this->repository->find($filter) as $training) {
98+ $authors[$training->author->id()]= $training->author;
99+ }
100+ return $authors;
101+ }
102+ }
103+ ```
104+
105+ The resulting value inside * $filter* will be ` ["status" => "COMPLETED", "orgunits" => ["A", "B"]] ` .
83106
84107Return types
85108------------
You can’t perform that action at this time.
0 commit comments