docs
docs copied to clipboard
Autowire attribute
I didn't do too much digging, but this did't work in Symfony 7:
public function __construct(
#[Autowire('api_platform.doctrine.orm.state.item_provider')]
private ProviderInterface $itemProvider,
)
what worked:
public function __construct(
#[Autowire(service: CollectionProvider::class)] private readonly CollectionProvider $collectionProvider
)
Documentation page: https://api-platform.com/docs/core/state-providers/
I had the following error with the docs code:
"MyProvider::__construct(): Argument #1 ($collectionProvider) must be of type ApiPlatform\\State\\ProviderInterface, string given, called in .."