Skip to content

Commit 4282f31

Browse files
authored
Update bootstrap.md (#1804)
Fixed some errors that came up during bootstrap
1 parent 3979850 commit 4282f31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/bootstrap.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ use ApiPlatform\JsonLd\Serializer\ObjectNormalizer as JsonLdObjectNormalizer;
5757
use ApiPlatform\JsonLd\ContextBuilder as JsonLdContextBuilder;
5858
use ApiPlatform\JsonSchema\SchemaFactory;
5959
use ApiPlatform\JsonSchema\TypeFactory;
60+
use ApiPlatform\Metadata\ApiResource;
6061
use ApiPlatform\Metadata\CollectionOperationInterface;
6162
use ApiPlatform\Metadata\HttpOperation;
6263
use ApiPlatform\Metadata\Operation;
@@ -257,7 +258,7 @@ $providerCollection = new class implements ContainerInterface {
257258
}
258259

259260
public function has($id): bool {
260-
return isset($this->providers['id']);
261+
return isset($this->providers[$id]);
261262
}
262263
};
263264
$stateProviders = new CallableProvider($providerCollection);
@@ -289,6 +290,12 @@ class Validator implements ValidatorInterface {
289290
$validator = new Validator(Validation::createValidator());
290291
$validateListener = new ValidateListener($validator, $resourceMetadataFactory);
291292

293+
#[ApiResource(provider: \BookProvider::class)]
294+
class Book
295+
{
296+
public int $id;
297+
}
298+
292299
class BookProvider implements ProviderInterface
293300
{
294301
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null

0 commit comments

Comments
 (0)