Guides
Tutorials
class ApiPlatform\Metadata\HttpOperation extends ApiPlatform\Metadata\Operation
{
public __construct(string $method, null|string $uriTemplate, null|array<int, string> $types, array<int
string, string
array<int, string>>|string $formats, array<int
string, string
array<int, string>>|string $inputFormats, array<int
string, string
array<int, string>>|string $outputFormats, array<string, array
array
ApiPlatform\Metadata\Link>|array<int, string>|string $uriVariables, null|string $routePrefix, null|string $routeName, null|array $defaults, null|array $requirements, null|array $options, null|bool $stateless, null|string $sunset, null|string $acceptPatch, string|int $status, null|string $host, null|array $schemes, null|string $condition, null|string $controller, null|array $cacheHeaders, null|array $paginationViaCursor, null|array $hydraContext, null|array $openapiContext, null|ApiPlatform\OpenApi\Model\Operation|bool $openapi, null|array $exceptionToStatus, null|bool $queryParameterValidationEnabled, null|string $shortName, null|string $class, null|bool $paginationEnabled, null|string $paginationType, null|int $paginationItemsPerPage, null|int $paginationMaximumItemsPerPage, null|bool $paginationPartial, null|bool $paginationClientEnabled, null|bool $paginationClientItemsPerPage, null|bool $paginationClientPartial, null|bool $paginationFetchJoinCollection, null|bool $paginationUseOutputWalkers, null|array $order, null|string $description, null|array $normalizationContext, null|array $denormalizationContext, null|bool $collectDenormalizationErrors, null|string $security, null|string $securityMessage, null|string $securityPostDenormalize, null|string $securityPostDenormalizeMessage, null|string $securityPostValidation, null|string $securityPostValidationMessage, null|string $deprecationReason, null|array $filters, null|array $validationContext, array|string|false $input, array|string|false $output, string|array|bool $mercure, string|bool $messenger, null|bool $elasticsearch, null|int $urlGenerationStrategy, null|bool $read, null|bool $deserialize, null|bool $validate, null|bool $write, null|bool $serialize, null|bool $fetchPartial, null|bool $forceEager, null|int $priority, null|string $name, string|callable $provider, string|callable $processor, null|ApiPlatform\State\OptionsInterface $stateOptions, array $extraProperties)
public getMethod(): string
public withMethod(string $method): ApiPlatform\Metadata\HttpOperation
public getUriTemplate(): string
public withUriTemplate(null|string $uriTemplate)
public getTypes(): array
public withTypes(array<int, string>|string $types): ApiPlatform\Metadata\HttpOperation
public getFormats()
public withFormats($formats): ApiPlatform\Metadata\HttpOperation
public getInputFormats()
public withInputFormats($inputFormats): ApiPlatform\Metadata\HttpOperation
public getOutputFormats()
public withOutputFormats($outputFormats): ApiPlatform\Metadata\HttpOperation
public getUriVariables()
public withUriVariables($uriVariables): ApiPlatform\Metadata\HttpOperation
public getRoutePrefix(): string
public withRoutePrefix(string $routePrefix): ApiPlatform\Metadata\HttpOperation
public getRouteName(): string
public withRouteName(null|string $routeName): ApiPlatform\Metadata\HttpOperation
public getDefaults(): array
public withDefaults(array $defaults): ApiPlatform\Metadata\HttpOperation
public getRequirements(): array
public withRequirements(array $requirements): ApiPlatform\Metadata\HttpOperation
public getOptions(): array
public withOptions(array $options): ApiPlatform\Metadata\HttpOperation
public getStateless(): bool
public withStateless($stateless): ApiPlatform\Metadata\HttpOperation
public getSunset(): string
public withSunset(string $sunset): ApiPlatform\Metadata\HttpOperation
public getAcceptPatch(): string
public withAcceptPatch(string $acceptPatch): ApiPlatform\Metadata\HttpOperation
public getStatus(): int
public withStatus(int $status): ApiPlatform\Metadata\HttpOperation
public getHost(): string
public withHost(string $host): ApiPlatform\Metadata\HttpOperation
public getSchemes(): array
public withSchemes(array $schemes): ApiPlatform\Metadata\HttpOperation
public getCondition(): string
public withCondition(string $condition): ApiPlatform\Metadata\HttpOperation
public getController(): string
public withController(string $controller): ApiPlatform\Metadata\HttpOperation
public getCacheHeaders(): array
public withCacheHeaders(array $cacheHeaders): ApiPlatform\Metadata\HttpOperation
public getPaginationViaCursor(): array
public withPaginationViaCursor(array $paginationViaCursor): ApiPlatform\Metadata\HttpOperation
public getHydraContext(): array
public withHydraContext(array $hydraContext): ApiPlatform\Metadata\HttpOperation
public getOpenapiContext(): array
public withOpenapiContext(array $openapiContext): ApiPlatform\Metadata\HttpOperation
public getOpenapi(): ApiPlatform\OpenApi\Model\Operation|bool
public withOpenapi(ApiPlatform\OpenApi\Model\Operation|bool $openapi): ApiPlatform\Metadata\HttpOperation
public getExceptionToStatus(): array
public withExceptionToStatus(array $exceptionToStatus): ApiPlatform\Metadata\HttpOperation
public getQueryParameterValidationEnabled(): bool
public withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): ApiPlatform\Metadata\HttpOperation
public withOperation($operation)
public canRead(): bool
public withRead(bool $read): ApiPlatform\Metadata\Operation
public canDeserialize(): bool
public withDeserialize(bool $deserialize): ApiPlatform\Metadata\Operation
public canValidate(): bool
public withValidate(bool $validate): ApiPlatform\Metadata\Operation
public canWrite(): bool
public withWrite(bool $write): ApiPlatform\Metadata\Operation
public canSerialize(): bool
public withSerialize(bool $serialize): ApiPlatform\Metadata\Operation
public getPriority(): int
public withPriority(int $priority): ApiPlatform\Metadata\Operation
public getName(): string
public withName(string $name): ApiPlatform\Metadata\Operation
public getShortName(): string
public withShortName(string $shortName): static
public getClass(): string
public withClass(string $class): static
public getDescription(): string
public withDescription(null|string $description): static
public getUrlGenerationStrategy(): int
public withUrlGenerationStrategy(int $urlGenerationStrategy): static
public getDeprecationReason(): string
public withDeprecationReason($deprecationReason): static
public getNormalizationContext(): array
public withNormalizationContext(array $normalizationContext): static
public getDenormalizationContext(): array
public withDenormalizationContext(array $denormalizationContext): static
public getCollectDenormalizationErrors(): bool
public withCollectDenormalizationErrors(null|bool $collectDenormalizationErrors): static
public getValidationContext(): array
public withValidationContext(array $validationContext): static
public getFilters(): array<int, string>
public withFilters(array $filters): static
public getElasticsearch(): bool
public withElasticsearch(bool $elasticsearch): static
public getMercure(): array|bool
public withMercure($mercure): static
public getMessenger()
public withMessenger($messenger): static
public getInput()
public withInput($input): static
public getOutput()
public withOutput($output): static
public getOrder(): array
public withOrder(array $order): static
public getFetchPartial(): bool
public withFetchPartial(bool $fetchPartial): static
public getForceEager(): bool
public withForceEager(bool $forceEager): static
public getPaginationEnabled(): bool
public withPaginationEnabled(bool $paginationEnabled): static
public getPaginationType(): string
public withPaginationType(string $paginationType): static
public getPaginationItemsPerPage(): int
public withPaginationItemsPerPage(int $paginationItemsPerPage): static
public getPaginationMaximumItemsPerPage(): int
public withPaginationMaximumItemsPerPage(int $paginationMaximumItemsPerPage): static
public getPaginationPartial(): bool
public withPaginationPartial(bool $paginationPartial): static
public getPaginationClientEnabled(): bool
public withPaginationClientEnabled(bool $paginationClientEnabled): static
public getPaginationClientItemsPerPage(): bool
public withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
public getPaginationClientPartial(): bool
public withPaginationClientPartial(bool $paginationClientPartial): static
public getPaginationFetchJoinCollection(): bool
public withPaginationFetchJoinCollection(bool $paginationFetchJoinCollection): static
public getPaginationUseOutputWalkers(): bool
public withPaginationUseOutputWalkers(bool $paginationUseOutputWalkers): static
public getSecurity(): string
public withSecurity($security): static
public getSecurityMessage(): string
public withSecurityMessage(string $securityMessage): static
public getSecurityPostDenormalize(): string
public withSecurityPostDenormalize($securityPostDenormalize): static
public getSecurityPostDenormalizeMessage(): string
public withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
public getSecurityPostValidation(): string
public withSecurityPostValidation(null|string $securityPostValidation): static
public getSecurityPostValidationMessage(): string
public withSecurityPostValidationMessage(null|string $securityPostValidationMessage): static
public getProcessor(): callable|string
public withProcessor(null|callable|string $processor): static
public getProvider(): callable|string
public withProvider(null|callable|string $provider): static
public getStateOptions(): ApiPlatform\State\OptionsInterface
public withStateOptions(null|ApiPlatform\State\OptionsInterface $stateOptions): static
public getExtraProperties(): array
public withExtraProperties(array $extraProperties): static
protected copyFrom(ApiPlatform\Metadata\Metadata $resource): static
}
class ApiPlatform\Metadata\HttpOperation extends ApiPlatform\Metadata\Operation
{
public __construct(string $method, null|string $uriTemplate, null|array<int, string> $types, array<int
string, string
array<int, string>>|string $formats, array<int
string, string
array<int, string>>|string $inputFormats, array<int
string, string
array<int, string>>|string $outputFormats, array<string, array
array
ApiPlatform\Metadata\Link>|array<int, string>|string $uriVariables, null|string $routePrefix, null|string $routeName, null|array $defaults, null|array $requirements, null|array $options, null|bool $stateless, null|string $sunset, null|string $acceptPatch, string|int $status, null|string $host, null|array $schemes, null|string $condition, null|string $controller, null|array $cacheHeaders, null|array $paginationViaCursor, null|array $hydraContext, null|array $openapiContext, null|ApiPlatform\OpenApi\Model\Operation|bool $openapi, null|array $exceptionToStatus, null|bool $queryParameterValidationEnabled, null|string $shortName, null|string $class, null|bool $paginationEnabled, null|string $paginationType, null|int $paginationItemsPerPage, null|int $paginationMaximumItemsPerPage, null|bool $paginationPartial, null|bool $paginationClientEnabled, null|bool $paginationClientItemsPerPage, null|bool $paginationClientPartial, null|bool $paginationFetchJoinCollection, null|bool $paginationUseOutputWalkers, null|array $order, null|string $description, null|array $normalizationContext, null|array $denormalizationContext, null|bool $collectDenormalizationErrors, null|string $security, null|string $securityMessage, null|string $securityPostDenormalize, null|string $securityPostDenormalizeMessage, null|string $securityPostValidation, null|string $securityPostValidationMessage, null|string $deprecationReason, null|array $filters, null|array $validationContext, array|string|false $input, array|string|false $output, string|array|bool $mercure, string|bool $messenger, null|bool $elasticsearch, null|int $urlGenerationStrategy, null|bool $read, null|bool $deserialize, null|bool $validate, null|bool $write, null|bool $serialize, null|bool $fetchPartial, null|bool $forceEager, null|int $priority, null|string $name, string|callable $provider, string|callable $processor, null|ApiPlatform\State\OptionsInterface $stateOptions, array $extraProperties)
public getMethod(): string
public withMethod(string $method): ApiPlatform\Metadata\HttpOperation
public getUriTemplate(): string
public withUriTemplate(null|string $uriTemplate)
public getTypes(): array
public withTypes(array<int, string>|string $types): ApiPlatform\Metadata\HttpOperation
public getFormats()
public withFormats($formats): ApiPlatform\Metadata\HttpOperation
public getInputFormats()
public withInputFormats($inputFormats): ApiPlatform\Metadata\HttpOperation
public getOutputFormats()
public withOutputFormats($outputFormats): ApiPlatform\Metadata\HttpOperation
public getUriVariables()
public withUriVariables($uriVariables): ApiPlatform\Metadata\HttpOperation
public getRoutePrefix(): string
public withRoutePrefix(string $routePrefix): ApiPlatform\Metadata\HttpOperation
public getRouteName(): string
public withRouteName(null|string $routeName): ApiPlatform\Metadata\HttpOperation
public getDefaults(): array
public withDefaults(array $defaults): ApiPlatform\Metadata\HttpOperation
public getRequirements(): array
public withRequirements(array $requirements): ApiPlatform\Metadata\HttpOperation
public getOptions(): array
public withOptions(array $options): ApiPlatform\Metadata\HttpOperation
public getStateless(): bool
public withStateless($stateless): ApiPlatform\Metadata\HttpOperation
public getSunset(): string
public withSunset(string $sunset): ApiPlatform\Metadata\HttpOperation
public getAcceptPatch(): string
public withAcceptPatch(string $acceptPatch): ApiPlatform\Metadata\HttpOperation
public getStatus(): int
public withStatus(int $status): ApiPlatform\Metadata\HttpOperation
public getHost(): string
public withHost(string $host): ApiPlatform\Metadata\HttpOperation
public getSchemes(): array
public withSchemes(array $schemes): ApiPlatform\Metadata\HttpOperation
public getCondition(): string
public withCondition(string $condition): ApiPlatform\Metadata\HttpOperation
public getController(): string
public withController(string $controller): ApiPlatform\Metadata\HttpOperation
public getCacheHeaders(): array
public withCacheHeaders(array $cacheHeaders): ApiPlatform\Metadata\HttpOperation
public getPaginationViaCursor(): array
public withPaginationViaCursor(array $paginationViaCursor): ApiPlatform\Metadata\HttpOperation
public getHydraContext(): array
public withHydraContext(array $hydraContext): ApiPlatform\Metadata\HttpOperation
public getOpenapiContext(): array
public withOpenapiContext(array $openapiContext): ApiPlatform\Metadata\HttpOperation
public getOpenapi(): ApiPlatform\OpenApi\Model\Operation|bool
public withOpenapi(ApiPlatform\OpenApi\Model\Operation|bool $openapi): ApiPlatform\Metadata\HttpOperation
public getExceptionToStatus(): array
public withExceptionToStatus(array $exceptionToStatus): ApiPlatform\Metadata\HttpOperation
public getQueryParameterValidationEnabled(): bool
public withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): ApiPlatform\Metadata\HttpOperation
public withOperation($operation)
public canRead(): bool
public withRead(bool $read): ApiPlatform\Metadata\Operation
public canDeserialize(): bool
public withDeserialize(bool $deserialize): ApiPlatform\Metadata\Operation
public canValidate(): bool
public withValidate(bool $validate): ApiPlatform\Metadata\Operation
public canWrite(): bool
public withWrite(bool $write): ApiPlatform\Metadata\Operation
public canSerialize(): bool
public withSerialize(bool $serialize): ApiPlatform\Metadata\Operation
public getPriority(): int
public withPriority(int $priority): ApiPlatform\Metadata\Operation
public getName(): string
public withName(string $name): ApiPlatform\Metadata\Operation
public getShortName(): string
public withShortName(string $shortName): static
public getClass(): string
public withClass(string $class): static
public getDescription(): string
public withDescription(null|string $description): static
public getUrlGenerationStrategy(): int
public withUrlGenerationStrategy(int $urlGenerationStrategy): static
public getDeprecationReason(): string
public withDeprecationReason($deprecationReason): static
public getNormalizationContext(): array
public withNormalizationContext(array $normalizationContext): static
public getDenormalizationContext(): array
public withDenormalizationContext(array $denormalizationContext): static
public getCollectDenormalizationErrors(): bool
public withCollectDenormalizationErrors(null|bool $collectDenormalizationErrors): static
public getValidationContext(): array
public withValidationContext(array $validationContext): static
public getFilters(): array<int, string>
public withFilters(array $filters): static
public getElasticsearch(): bool
public withElasticsearch(bool $elasticsearch): static
public getMercure(): array|bool
public withMercure($mercure): static
public getMessenger()
public withMessenger($messenger): static
public getInput()
public withInput($input): static
public getOutput()
public withOutput($output): static
public getOrder(): array
public withOrder(array $order): static
public getFetchPartial(): bool
public withFetchPartial(bool $fetchPartial): static
public getForceEager(): bool
public withForceEager(bool $forceEager): static
public getPaginationEnabled(): bool
public withPaginationEnabled(bool $paginationEnabled): static
public getPaginationType(): string
public withPaginationType(string $paginationType): static
public getPaginationItemsPerPage(): int
public withPaginationItemsPerPage(int $paginationItemsPerPage): static
public getPaginationMaximumItemsPerPage(): int
public withPaginationMaximumItemsPerPage(int $paginationMaximumItemsPerPage): static
public getPaginationPartial(): bool
public withPaginationPartial(bool $paginationPartial): static
public getPaginationClientEnabled(): bool
public withPaginationClientEnabled(bool $paginationClientEnabled): static
public getPaginationClientItemsPerPage(): bool
public withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
public getPaginationClientPartial(): bool
public withPaginationClientPartial(bool $paginationClientPartial): static
public getPaginationFetchJoinCollection(): bool
public withPaginationFetchJoinCollection(bool $paginationFetchJoinCollection): static
public getPaginationUseOutputWalkers(): bool
public withPaginationUseOutputWalkers(bool $paginationUseOutputWalkers): static
public getSecurity(): string
public withSecurity($security): static
public getSecurityMessage(): string
public withSecurityMessage(string $securityMessage): static
public getSecurityPostDenormalize(): string
public withSecurityPostDenormalize($securityPostDenormalize): static
public getSecurityPostDenormalizeMessage(): string
public withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
public getSecurityPostValidation(): string
public withSecurityPostValidation(null|string $securityPostValidation): static
public getSecurityPostValidationMessage(): string
public withSecurityPostValidationMessage(null|string $securityPostValidationMessage): static
public getProcessor(): callable|string
public withProcessor(null|callable|string $processor): static
public getProvider(): callable|string
public withProvider(null|callable|string $provider): static
public getStateOptions(): ApiPlatform\State\OptionsInterface
public withStateOptions(null|ApiPlatform\State\OptionsInterface $stateOptions): static
public getExtraProperties(): array
public withExtraProperties(array $extraProperties): static
protected copyFrom(ApiPlatform\Metadata\Metadata $resource): static
}
string $method
string $method
string $uriTemplate
string $uriTemplate
array $types
array $types
$formats
$formats
$inputFormats
$inputFormats
$outputFormats
$outputFormats
$uriVariables
$uriVariables
string $routePrefix
string $routePrefix
string $routeName
string $routeName
array $defaults
array $defaults
array $requirements
array $requirements
array $options
array $options
bool $stateless
bool $stateless
string $sunset
string $sunset
The sunset
option indicates when a deprecated operation will be removed.
<?php
// api/src/Entity/Parchment.php
use ApiPlatform\Metadata\Get;
#[Get(deprecationReason: 'Create a Book instead', sunset: '01/01/2020')]
class Parchment
{
// ...
}
<?php
// api/src/Entity/Parchment.php
use ApiPlatform\Metadata\Get;
#[Get(deprecationReason: 'Create a Book instead', sunset: '01/01/2020')]
class Parchment
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Parchment:
- operations:
ApiPlatform\Metadata\Get:
deprecationReason: 'Create a Book instead'
sunset: '01/01/2020'
# api/config/api_platform/resources.yaml
resources:
App\Entity\Parchment:
- operations:
ApiPlatform\Metadata\Get:
deprecationReason: 'Create a Book instead'
sunset: '01/01/2020'
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Parchment">
<operations>
<operation class="ApiPlatform\Metadata\Get" deprecationReason="Create a Book instead" sunset="01/01/2020" />
<operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Parchment">
<operations>
<operation class="ApiPlatform\Metadata\Get" deprecationReason="Create a Book instead" sunset="01/01/2020" />
<operations>
</resource>
</resources>
string $acceptPatch
string $acceptPatch
$status
$status
string $host
string $host
array $schemes
array $schemes
string $condition
string $condition
string $controller
string $controller
array $cacheHeaders
array $cacheHeaders
array $paginationViaCursor
array $paginationViaCursor
array $hydraContext
array $hydraContext
array $openapiContext
array $openapiContext
ApiPlatform\OpenApi\Model\Operation|bool $openapi
ApiPlatform\OpenApi\Model\Operation|bool $openapi
array $exceptionToStatus
array $exceptionToStatus
bool $queryParameterValidationEnabled
bool $queryParameterValidationEnabled
string $shortName
string $shortName
string $class
string $class
bool $paginationEnabled
bool $paginationEnabled
The paginationEnabled
option enables (or disables) the pagination for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationEnabled: true)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationEnabled: true)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationEnabled: true
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationEnabled: true
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationEnabled=true />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationEnabled=true />
</operations>
</resource>
</resources>
string $paginationType
string $paginationType
The paginationType
option defines the type of pagination (page
or cursor
) to use for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationType: 'page')]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationType: 'page')]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationType: page
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationType: page
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationType="page" />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationType="page" />
</operations>
</resource>
</resources>
int $paginationItemsPerPage
int $paginationItemsPerPage
The paginationItemsPerPage
option defines the number of items per page for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationItemsPerPage: 30)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationItemsPerPage: 30)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationItemsPerPage: 30
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationItemsPerPage: 30
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationItemsPerPage=30 />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationItemsPerPage=30 />
</operations>
</resource>
</resources>
int $paginationMaximumItemsPerPage
int $paginationMaximumItemsPerPage
The paginationMaximumItemsPerPage
option defines the maximum number of items per page for the current resource.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationMaximumItemsPerPage: 50)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationMaximumItemsPerPage: 50)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationMaximumItemsPerPage: 50
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationMaximumItemsPerPage: 50
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationMaximumItemsPerPage=50 />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationMaximumItemsPerPage=50 />
</operations>
</resource>
</resources>
bool $paginationPartial
bool $paginationPartial
The paginationPartial
option enables (or disables) the partial pagination for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationPartial: true)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationPartial: true)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationPartial: true
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationPartial: true
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationPartial=true />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationPartial=true />
</operations>
</resource>
</resources>
bool $paginationClientEnabled
bool $paginationClientEnabled
The paginationClientEnabled
option allows (or disallows) the client to enable (or disable) the pagination for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationClientEnabled: true)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationClientEnabled: true)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationClientEnabled: true
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationClientEnabled: true
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationClientEnabled=true />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationClientEnabled=true />
</operations>
</resource>
</resources>
The pagination can now be enabled (or disabled) by adding a query parameter named pagination
:
GET /books?pagination=false
: disabledGET /books?pagination=true
: enabledbool $paginationClientItemsPerPage
bool $paginationClientItemsPerPage
The paginationClientItemsPerPage
option allows (or disallows) the client to set the number of items per page for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationClientItemsPerPage: true)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationClientItemsPerPage: true)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationClientItemsPerPage: true
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationClientItemsPerPage: true
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationClientItemsPerPage=true />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationClientItemsPerPage=true />
</operations>
</resource>
</resources>
The number of items can now be set by adding a query parameter named itemsPerPage
:
GET /books?itemsPerPage=50
bool $paginationClientPartial
bool $paginationClientPartial
The paginationClientPartial
option allows (or disallows) the client to enable (or disable) the partial pagination for the current collection operation.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationClientPartial: true)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationClientPartial: true)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationClientPartial: true
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationClientPartial: true
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationClientPartial=true />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationClientPartial=true />
</operations>
</resource>
</resources>
The partial pagination can now be enabled (or disabled) by adding a query parameter named partial
:
GET /books?partial=false
: disabledGET /books?partial=true
: enabledbool $paginationFetchJoinCollection
bool $paginationFetchJoinCollection
The PaginationExtension of API Platform performs some checks on the QueryBuilder
to guess, in most common
cases, the correct values to use when configuring the Doctrine ORM Paginator: $fetchJoinCollection
argument, whether there is a join to a collection-valued association.
When set to true
, the Doctrine ORM Paginator will perform an additional query, in order to get the
correct number of results. You can configure this using the paginationFetchJoinCollection
option:
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationFetchJoinCollection: false)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationFetchJoinCollection: false)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationFetchJoinCollection: false
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationFetchJoinCollection: false
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationFetchJoinCollection=false />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationFetchJoinCollection=false />
</operations>
</resource>
</resources>
For more information, please see the Pagination entry in the Doctrine ORM documentation.
bool $paginationUseOutputWalkers
bool $paginationUseOutputWalkers
The PaginationExtension of API Platform performs some checks on the QueryBuilder
to guess, in most common
cases, the correct values to use when configuring the Doctrine ORM Paginator: $setUseOutputWalkers
setter,
whether to use output walkers.
When set to true
, the Doctrine ORM Paginator will use output walkers, which are compulsory for some types
of queries. You can configure this using the paginationUseOutputWalkers
option:
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationUseOutputWalkers: false)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(paginationUseOutputWalkers: false)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationUseOutputWalkers: false
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
paginationUseOutputWalkers: false
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationUseOutputWalkers=false />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" paginationUseOutputWalkers=false />
</operations>
</resource>
</resources>
For more information, please see the Pagination entry in the Doctrine ORM documentation.
array $order
array $order
string $description
string $description
array $normalizationContext
array $normalizationContext
array $denormalizationContext
array $denormalizationContext
bool $collectDenormalizationErrors
bool $collectDenormalizationErrors
string $security
string $security
string $securityMessage
string $securityMessage
string $securityPostDenormalize
string $securityPostDenormalize
string $securityPostDenormalizeMessage
string $securityPostDenormalizeMessage
string $securityPostValidation
string $securityPostValidation
string $securityPostValidationMessage
string $securityPostValidationMessage
string $deprecationReason
string $deprecationReason
The deprecationReason
option deprecates the current operation with a deprecation message.
<?php
// api/src/Entity/Parchment.php
use ApiPlatform\Metadata\Get;
#[Get(deprecationReason: 'Create a Book instead')]
class Parchment
{
// ...
}
<?php
// api/src/Entity/Parchment.php
use ApiPlatform\Metadata\Get;
#[Get(deprecationReason: 'Create a Book instead')]
class Parchment
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Parchment:
- operations:
ApiPlatform\Metadata\Get:
deprecationReason: 'Create a Book instead'
# api/config/api_platform/resources.yaml
resources:
App\Entity\Parchment:
- operations:
ApiPlatform\Metadata\Get:
deprecationReason: 'Create a Book instead'
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Parchment">
<operations>
<operation class="ApiPlatform\Metadata\Get" deprecationReason="Create a Book instead" />
<operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Parchment">
<operations>
<operation class="ApiPlatform\Metadata\Get" deprecationReason="Create a Book instead" />
<operations>
</resource>
</resources>
owl:deprecated
annotation property will be added to the appropriate data structuredeprecated
property will be addedisDeprecated
and deprecationReason
properties will be added to the schemaarray $filters
array $filters
The filters
option configures the filters (declared as services) available on the collection routes for the current resource.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(filters: ['app.filters.book.search'])]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\GetCollection;
#[GetCollection(filters: ['app.filters.book.search'])]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
filters: ['app.filters.book.search']
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\GetCollection:
filters: ['app.filters.book.search']
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection">
<filters>
<filter>app.filters.book.search</filter>
</filters>
</operation>
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection">
<filters>
<filter>app.filters.book.search</filter>
</filters>
</operation>
</operations>
</resource>
</resources>
array $validationContext
array $validationContext
The validationContext
option configure the context of validation for the current Operation.
You can, for instance, describe the validation groups that will be used :
#[Put(validationContext: ['groups' => ['Default', 'putValidation']])]
#[Post(validationContext: ['groups' => ['Default', 'postValidation']])]
#[Put(validationContext: ['groups' => ['Default', 'putValidation']])]
#[Post(validationContext: ['groups' => ['Default', 'postValidation']])]
For more examples, read our guide on validation.
$input
$input
$output
$output
$mercure
$mercure
string|bool $messenger
string|bool $messenger
The messenger
option dispatches the current resource through the Message Bus.
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\Post;
#[Post(messenger: true)]
class Book
{
// ...
}
<?php
// api/src/Entity/Book.php
use ApiPlatform\Metadata\Post;
#[Post(messenger: true)]
class Book
{
// ...
}
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\Post:
messenger: true
# api/config/api_platform/resources.yaml
resources:
App\Entity\Book:
- operations:
ApiPlatform\Metadata\Post:
messenger: true
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\Post" messenger=true />
</operations>
</resource>
</resources>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\Post" messenger=true />
</operations>
</resource>
</resources>
Note: when using messenger=true
on a Doctrine entity, the Doctrine Processor is not called. If you want it
to be called, you should decorate a built-in state processor
and implement your own logic.
Read how to use Messenger with an Input object.
bool $elasticsearch
bool $elasticsearch
int $urlGenerationStrategy
int $urlGenerationStrategy
bool $read
bool $read
bool $deserialize
bool $deserialize
bool $validate
bool $validate
bool $write
bool $write
bool $serialize
bool $serialize
bool $fetchPartial
bool $fetchPartial
bool $forceEager
bool $forceEager
int $priority
int $priority
string $name
string $name
$provider
$provider
$processor
$processor
ApiPlatform\State\OptionsInterface $stateOptions
ApiPlatform\State\OptionsInterface $stateOptions
array $extraProperties
array $extraProperties
public __construct(string $method, null|string $uriTemplate, null|array<int, string> $types, array<int
string, string
array<int, string>>|string $formats, array<int
string, string
array<int, string>>|string $inputFormats, array<int
string, string
array<int, string>>|string $outputFormats, array<string, array
array
ApiPlatform\Metadata\Link>|array<int, string>|string $uriVariables, null|string $routePrefix, null|string $routeName, null|array $defaults, null|array $requirements, null|array $options, null|bool $stateless, null|string $sunset, null|string $acceptPatch, string|int $status, null|string $host, null|array $schemes, null|string $condition, null|string $controller, null|array $cacheHeaders, null|array $paginationViaCursor, null|array $hydraContext, null|array $openapiContext, null|ApiPlatform\OpenApi\Model\Operation|bool $openapi, null|array $exceptionToStatus, null|bool $queryParameterValidationEnabled, null|string $shortName, null|string $class, null|bool $paginationEnabled, null|string $paginationType, null|int $paginationItemsPerPage, null|int $paginationMaximumItemsPerPage, null|bool $paginationPartial, null|bool $paginationClientEnabled, null|bool $paginationClientItemsPerPage, null|bool $paginationClientPartial, null|bool $paginationFetchJoinCollection, null|bool $paginationUseOutputWalkers, null|array $order, null|string $description, null|array $normalizationContext, null|array $denormalizationContext, null|bool $collectDenormalizationErrors, null|string $security, null|string $securityMessage, null|string $securityPostDenormalize, null|string $securityPostDenormalizeMessage, null|string $securityPostValidation, null|string $securityPostValidationMessage, null|string $deprecationReason, null|array $filters, null|array $validationContext, array|string|false $input, array|string|false $output, string|array|bool $mercure, string|bool $messenger, null|bool $elasticsearch, null|int $urlGenerationStrategy, null|bool $read, null|bool $deserialize, null|bool $validate, null|bool $write, null|bool $serialize, null|bool $fetchPartial, null|bool $forceEager, null|int $priority, null|string $name, string|callable $provider, string|callable $processor, null|ApiPlatform\State\OptionsInterface $stateOptions, array $extraProperties)
public __construct(string $method, null|string $uriTemplate, null|array<int, string> $types, array<int
string, string
array<int, string>>|string $formats, array<int
string, string
array<int, string>>|string $inputFormats, array<int
string, string
array<int, string>>|string $outputFormats, array<string, array
array
ApiPlatform\Metadata\Link>|array<int, string>|string $uriVariables, null|string $routePrefix, null|string $routeName, null|array $defaults, null|array $requirements, null|array $options, null|bool $stateless, null|string $sunset, null|string $acceptPatch, string|int $status, null|string $host, null|array $schemes, null|string $condition, null|string $controller, null|array $cacheHeaders, null|array $paginationViaCursor, null|array $hydraContext, null|array $openapiContext, null|ApiPlatform\OpenApi\Model\Operation|bool $openapi, null|array $exceptionToStatus, null|bool $queryParameterValidationEnabled, null|string $shortName, null|string $class, null|bool $paginationEnabled, null|string $paginationType, null|int $paginationItemsPerPage, null|int $paginationMaximumItemsPerPage, null|bool $paginationPartial, null|bool $paginationClientEnabled, null|bool $paginationClientItemsPerPage, null|bool $paginationClientPartial, null|bool $paginationFetchJoinCollection, null|bool $paginationUseOutputWalkers, null|array $order, null|string $description, null|array $normalizationContext, null|array $denormalizationContext, null|bool $collectDenormalizationErrors, null|string $security, null|string $securityMessage, null|string $securityPostDenormalize, null|string $securityPostDenormalizeMessage, null|string $securityPostValidation, null|string $securityPostValidationMessage, null|string $deprecationReason, null|array $filters, null|array $validationContext, array|string|false $input, array|string|false $output, string|array|bool $mercure, string|bool $messenger, null|bool $elasticsearch, null|int $urlGenerationStrategy, null|bool $read, null|bool $deserialize, null|bool $validate, null|bool $write, null|bool $serialize, null|bool $fetchPartial, null|bool $forceEager, null|int $priority, null|string $name, string|callable $provider, string|callable $processor, null|ApiPlatform\State\OptionsInterface $stateOptions, array $extraProperties)
method | string | |
uriTemplate | string | |
types | array<int, string> | the RDF types of this property |
formats | array<int
string, string
array<int, string>> string | https://api-platform.com/docs/core/content-negotiation/#configuring-formats-for-a-specific-resource-or-operation |
inputFormats | array<int
string, string
array<int, string>> string | https://api-platform.com/docs/core/content-negotiation/#configuring-formats-for-a-specific-resource-or-operation |
outputFormats | array<int
string, string
array<int, string>> string | https://api-platform.com/docs/core/content-negotiation/#configuring-formats-for-a-specific-resource-or-operation |
uriVariables | array<string, array
array
ApiPlatform\Metadata\Link> array<int, string> string | https://api-platform.com/docs/core/subresources/ |
routePrefix | string | https://api-platform.com/docs/core/operations/#prefixing-all-routes-of-all-operations |
routeName | string | |
defaults | array | |
requirements | array | |
options | array | |
stateless | bool | |
sunset | string | https://api-platform.com/docs/core/deprecations/#setting-the-sunset-http-header-to-indicate-when-a-resource-or-an-operation-will-be-removed |
acceptPatch | string | |
status | string int | https://api-platform.com/docs/core/operations/#configuring-operations |
host | string | |
schemes | array | |
condition | string | |
controller | string | |
cacheHeaders | array | https://api-platform.com/docs/core/performance/#setting-custom-http-cache-headers |
paginationViaCursor | array | https://api-platform.com/docs/core/pagination/#cursor-based-pagination |
hydraContext | array | https://api-platform.com/docs/core/extending-jsonld-context/#hydra |
openapiContext | array | https://api-platform.com/docs/core/openapi/#using-the-openapi-and-swagger-contexts |
openapi | ApiPlatform\OpenApi\Model\Operation bool | |
exceptionToStatus | array | |
queryParameterValidationEnabled | bool | |
shortName | string | |
class | string | |
paginationEnabled | bool | |
paginationType | string | |
paginationItemsPerPage | int | |
paginationMaximumItemsPerPage | int | |
paginationPartial | bool | |
paginationClientEnabled | bool | |
paginationClientItemsPerPage | bool | |
paginationClientPartial | bool | |
paginationFetchJoinCollection | bool | |
paginationUseOutputWalkers | bool | |
order | array | |
description | string | |
normalizationContext | array | https://api-platform.com/docs/core/serialization/#using-serialization-groups |
denormalizationContext | array | https://api-platform.com/docs/core/serialization/#using-serialization-groups |
collectDenormalizationErrors | bool | |
security | string | |
securityMessage | string | |
securityPostDenormalize | string | |
securityPostDenormalizeMessage | string | |
securityPostValidation | string | |
securityPostValidationMessage | string | |
deprecationReason | string | |
filters | array | |
validationContext | array | |
input | array string false | https://api-platform.com/docs/core/dto/#specifying-an-input-or-an-output-data-representation |
output | array string false | https://api-platform.com/docs/core/dto/#specifying-an-input-or-an-output-data-representation |
mercure | string array bool | https://api-platform.com/docs/core/mercure |
messenger | string bool | https://api-platform.com/docs/core/messenger/#dispatching-a-resource-through-the-message-bus |
elasticsearch | bool | |
urlGenerationStrategy | int | |
read | bool | |
deserialize | bool | |
validate | bool | |
write | bool | |
serialize | bool | |
fetchPartial | bool | |
forceEager | bool | |
priority | int | |
name | string | |
provider | string callable | https://api-platform.com/docs/core/state-providers/#state-providers |
processor | string callable | https://api-platform.com/docs/core/state-processors/#state-processors |
stateOptions | ApiPlatform\State\OptionsInterface | |
extraProperties | array |
public getMethod(): string
public getMethod(): string
string
public withMethod(string $method): ApiPlatform\Metadata\HttpOperation
public withMethod(string $method): ApiPlatform\Metadata\HttpOperation
method | string |
ApiPlatform\Metadata\HttpOperation
public getUriTemplate(): string
public getUriTemplate(): string
string
public withUriTemplate(null|string $uriTemplate)
public withUriTemplate(null|string $uriTemplate)
uriTemplate | string |
public getTypes(): array
public getTypes(): array
array
public withTypes(array<int, string>|string $types): ApiPlatform\Metadata\HttpOperation
public withTypes(array<int, string>|string $types): ApiPlatform\Metadata\HttpOperation
types | array<int, string> string |
ApiPlatform\Metadata\HttpOperation
public getFormats()
public getFormats()
public withFormats($formats): ApiPlatform\Metadata\HttpOperation
public withFormats($formats): ApiPlatform\Metadata\HttpOperation
formats |
ApiPlatform\Metadata\HttpOperation
public getInputFormats()
public getInputFormats()
public withInputFormats($inputFormats): ApiPlatform\Metadata\HttpOperation
public withInputFormats($inputFormats): ApiPlatform\Metadata\HttpOperation
inputFormats |
ApiPlatform\Metadata\HttpOperation
public getOutputFormats()
public getOutputFormats()
public withOutputFormats($outputFormats): ApiPlatform\Metadata\HttpOperation
public withOutputFormats($outputFormats): ApiPlatform\Metadata\HttpOperation
outputFormats |
ApiPlatform\Metadata\HttpOperation
public getUriVariables()
public getUriVariables()
public withUriVariables($uriVariables): ApiPlatform\Metadata\HttpOperation
public withUriVariables($uriVariables): ApiPlatform\Metadata\HttpOperation
uriVariables |
ApiPlatform\Metadata\HttpOperation
public getRoutePrefix(): string
public getRoutePrefix(): string
string
public withRoutePrefix(string $routePrefix): ApiPlatform\Metadata\HttpOperation
public withRoutePrefix(string $routePrefix): ApiPlatform\Metadata\HttpOperation
routePrefix | string |
ApiPlatform\Metadata\HttpOperation
public getRouteName(): string
public getRouteName(): string
string
public withRouteName(null|string $routeName): ApiPlatform\Metadata\HttpOperation
public withRouteName(null|string $routeName): ApiPlatform\Metadata\HttpOperation
routeName | string |
ApiPlatform\Metadata\HttpOperation
public getDefaults(): array
public getDefaults(): array
array
public withDefaults(array $defaults): ApiPlatform\Metadata\HttpOperation
public withDefaults(array $defaults): ApiPlatform\Metadata\HttpOperation
defaults | array |
ApiPlatform\Metadata\HttpOperation
public getRequirements(): array
public getRequirements(): array
array
public withRequirements(array $requirements): ApiPlatform\Metadata\HttpOperation
public withRequirements(array $requirements): ApiPlatform\Metadata\HttpOperation
requirements | array |
ApiPlatform\Metadata\HttpOperation
public getOptions(): array
public getOptions(): array
array
public withOptions(array $options): ApiPlatform\Metadata\HttpOperation
public withOptions(array $options): ApiPlatform\Metadata\HttpOperation
options | array |
ApiPlatform\Metadata\HttpOperation
public getStateless(): bool
public getStateless(): bool
bool
public withStateless($stateless): ApiPlatform\Metadata\HttpOperation
public withStateless($stateless): ApiPlatform\Metadata\HttpOperation
stateless |
ApiPlatform\Metadata\HttpOperation
public getSunset(): string
public getSunset(): string
string
public withSunset(string $sunset): ApiPlatform\Metadata\HttpOperation
public withSunset(string $sunset): ApiPlatform\Metadata\HttpOperation
sunset | string |
ApiPlatform\Metadata\HttpOperation
public getAcceptPatch(): string
public getAcceptPatch(): string
string
public withAcceptPatch(string $acceptPatch): ApiPlatform\Metadata\HttpOperation
public withAcceptPatch(string $acceptPatch): ApiPlatform\Metadata\HttpOperation
acceptPatch | string |
ApiPlatform\Metadata\HttpOperation
public getStatus(): int
public getStatus(): int
int
public withStatus(int $status): ApiPlatform\Metadata\HttpOperation
public withStatus(int $status): ApiPlatform\Metadata\HttpOperation
status | int |
ApiPlatform\Metadata\HttpOperation
public getHost(): string
public getHost(): string
string
public withHost(string $host): ApiPlatform\Metadata\HttpOperation
public withHost(string $host): ApiPlatform\Metadata\HttpOperation
host | string |
ApiPlatform\Metadata\HttpOperation
public getSchemes(): array
public getSchemes(): array
array
public withSchemes(array $schemes): ApiPlatform\Metadata\HttpOperation
public withSchemes(array $schemes): ApiPlatform\Metadata\HttpOperation
schemes | array |
ApiPlatform\Metadata\HttpOperation
public getCondition(): string
public getCondition(): string
string
public withCondition(string $condition): ApiPlatform\Metadata\HttpOperation
public withCondition(string $condition): ApiPlatform\Metadata\HttpOperation
condition | string |
ApiPlatform\Metadata\HttpOperation
public getController(): string
public getController(): string
string
public withController(string $controller): ApiPlatform\Metadata\HttpOperation
public withController(string $controller): ApiPlatform\Metadata\HttpOperation
controller | string |
ApiPlatform\Metadata\HttpOperation
public getCacheHeaders(): array
public getCacheHeaders(): array
array
public withCacheHeaders(array $cacheHeaders): ApiPlatform\Metadata\HttpOperation
public withCacheHeaders(array $cacheHeaders): ApiPlatform\Metadata\HttpOperation
cacheHeaders | array |
ApiPlatform\Metadata\HttpOperation
public getPaginationViaCursor(): array
public getPaginationViaCursor(): array
array
public withPaginationViaCursor(array $paginationViaCursor): ApiPlatform\Metadata\HttpOperation
public withPaginationViaCursor(array $paginationViaCursor): ApiPlatform\Metadata\HttpOperation
paginationViaCursor | array |
ApiPlatform\Metadata\HttpOperation
public getHydraContext(): array
public getHydraContext(): array
array
public withHydraContext(array $hydraContext): ApiPlatform\Metadata\HttpOperation
public withHydraContext(array $hydraContext): ApiPlatform\Metadata\HttpOperation
hydraContext | array |
ApiPlatform\Metadata\HttpOperation
public getOpenapiContext(): array
public getOpenapiContext(): array
array
public withOpenapiContext(array $openapiContext): ApiPlatform\Metadata\HttpOperation
public withOpenapiContext(array $openapiContext): ApiPlatform\Metadata\HttpOperation
openapiContext | array |
ApiPlatform\Metadata\HttpOperation
public getOpenapi(): ApiPlatform\OpenApi\Model\Operation|bool
public getOpenapi(): ApiPlatform\OpenApi\Model\Operation|bool
ApiPlatform\OpenApi\Model\Operation
bool
public withOpenapi(ApiPlatform\OpenApi\Model\Operation|bool $openapi): ApiPlatform\Metadata\HttpOperation
public withOpenapi(ApiPlatform\OpenApi\Model\Operation|bool $openapi): ApiPlatform\Metadata\HttpOperation
openapi | ApiPlatform\OpenApi\Model\Operation bool |
ApiPlatform\Metadata\HttpOperation
public getExceptionToStatus(): array
public getExceptionToStatus(): array
array
public withExceptionToStatus(array $exceptionToStatus): ApiPlatform\Metadata\HttpOperation
public withExceptionToStatus(array $exceptionToStatus): ApiPlatform\Metadata\HttpOperation
exceptionToStatus | array |
ApiPlatform\Metadata\HttpOperation
public getQueryParameterValidationEnabled(): bool
public getQueryParameterValidationEnabled(): bool
bool
public withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): ApiPlatform\Metadata\HttpOperation
public withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): ApiPlatform\Metadata\HttpOperation
queryParameterValidationEnabled | bool |