File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ use ApiPlatform\Metadata\CollectionOperationInterface;
114114 */
115115final class BlogPostProvider implements ProviderInterface
116116{
117- private array $data;
117+ // …
118118
119119 public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable|BlogPost|null
120120 {
@@ -172,6 +172,13 @@ final class BlogPostProvider implements ProviderInterface
172172{
173173 private array $data;
174174
175+ public function __construct() {
176+ $this->data = [
177+ 'ab' => new BlogPost('ab'),
178+ 'cd' => new BlogPost('cd'),
179+ ];
180+ }
181+
175182 public function provide(Operation $operation, array $uriVariables = [], array $context = []): BlogPost|null
176183 {
177184 return $this->data[$uriVariables['id']] ?? null;
@@ -219,7 +226,7 @@ use ApiPlatform\Metadata\CollectionOperationInterface;
219226 */
220227final class BlogPostProvider implements ProviderInterface
221228{
222- private array $data;
229+ // …
223230
224231 public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable|BlogPost|null
225232 {
You can’t perform that action at this time.
0 commit comments