Start your All-Access Pass to unlock this challenge
What is the purpose of the #[AsDecorator('api_platform.openapi.factory')] attribute?
#[AsDecorator('api_platform.openapi.factory')]
It's need to hook up proper dependency injection for the OpenApiFactoryDecorator using the api_platform.openapi.factory service.
OpenApiFactoryDecorator
api_platform.openapi.factory service
It enables automatic error handling in the OpenApiFactoryDecorator by linking it to the api_platform.openapi.factory service.
api_platform.openapi.factory
It allows the OpenApiFactoryDecorator to replace the core api_platform.openapi.factory service, but the original is passed to us.
It tells Symfony to create a "decorator" class around both our service and the core api_platform.openapi.factory service so both can be called.