Skip to content

Commit

Permalink
Update bootstrap.md (#1804)
Browse files Browse the repository at this point in the history
Fixed some errors that came up during bootstrap
  • Loading branch information
A1rPun authored Dec 7, 2023
1 parent 3979850 commit 4282f31
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use ApiPlatform\JsonLd\Serializer\ObjectNormalizer as JsonLdObjectNormalizer;
use ApiPlatform\JsonLd\ContextBuilder as JsonLdContextBuilder;
use ApiPlatform\JsonSchema\SchemaFactory;
use ApiPlatform\JsonSchema\TypeFactory;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\CollectionOperationInterface;
use ApiPlatform\Metadata\HttpOperation;
use ApiPlatform\Metadata\Operation;
Expand Down Expand Up @@ -257,7 +258,7 @@ $providerCollection = new class implements ContainerInterface {
}

public function has($id): bool {
return isset($this->providers['id']);
return isset($this->providers[$id]);
}
};
$stateProviders = new CallableProvider($providerCollection);
Expand Down Expand Up @@ -289,6 +290,12 @@ class Validator implements ValidatorInterface {
$validator = new Validator(Validation::createValidator());
$validateListener = new ValidateListener($validator, $resourceMetadataFactory);

#[ApiResource(provider: \BookProvider::class)]
class Book
{
public int $id;
}

class BookProvider implements ProviderInterface
{
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
Expand Down

0 comments on commit 4282f31

Please sign in to comment.