File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ use ApiPlatform\Metadata\CollectionOperationInterface;
125125 */
126126final class BlogPostProvider implements ProviderInterface
127127{
128- private array $data;
128+ // …
129129
130130 public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable|BlogPost|null
131131 {
@@ -185,6 +185,13 @@ final class BlogPostProvider implements ProviderInterface
185185{
186186 private array $data;
187187
188+ public function __construct() {
189+ $this->data = [
190+ 'ab' => new BlogPost('ab'),
191+ 'cd' => new BlogPost('cd'),
192+ ];
193+ }
194+
188195 public function provide(Operation $operation, array $uriVariables = [], array $context = []): BlogPost|null
189196 {
190197 return $this->data[$uriVariables['id']] ?? null;
@@ -236,7 +243,7 @@ use ApiPlatform\Metadata\CollectionOperationInterface;
236243 */
237244final class BlogPostProvider implements ProviderInterface
238245{
239- private array $data;
246+ // …
240247
241248 public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable|BlogPost|null
242249 {
You can’t perform that action at this time.
0 commit comments