Chooses the format to use according to the Accept header and supported formats.
class ApiPlatform\Symfony\EventListener\AddFormatListener
{
public __construct(|Negotiation\Negotiator $negotiator, null|`<a href="/docs/main/references/Metadata/Resource/Factory/ResourceMetadataCollectionFactoryInterface">ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, array $formats, array $errorFormats, array $docsFormats, null|bool $eventsBackwardCompatibility)
public onKernelRequest(Symfony\Component\HttpKernel\Event\RequestEvent $event): null
public setRequestErrorFormat(null|ApiPlatform\Metadata\HttpOperation $operation, Symfony\Component\HttpFoundation\Request $request): null
}
public __construct(|Negotiation\Negotiator $negotiator, null|`<a href="/docs/main/references/Metadata/Resource/Factory/ResourceMetadataCollectionFactoryInterface">ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, array $formats, array $errorFormats, array $docsFormats, null|bool $eventsBackwardCompatibility)
negotiator | `ApiPlatform\State\ProviderInterface` Negotiation\Negotiator | |
resourceMetadataCollectionFactory | `ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface` | |
formats | array | |
errorFormats | array | |
docsFormats | array | |
eventsBackwardCompatibility | bool |
Sets the applicable format to the HttpFoundation Request.
public onKernelRequest(Symfony\Component\HttpKernel\Event\RequestEvent $event): null
event | Symfony\Component\HttpKernel\Event\RequestEvent |
null
public setRequestErrorFormat(null|ApiPlatform\Metadata\HttpOperation $operation, Symfony\Component\HttpFoundation\Request $request): null
operation | `ApiPlatform\Metadata\HttpOperation` | |
request | Symfony\Component\HttpFoundation\Request |
null
Made with love by
Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.
Learn more