Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autowire attribute #1925

Open
PaulCombal opened this issue Mar 19, 2024 · 0 comments
Open

Autowire attribute #1925

PaulCombal opened this issue Mar 19, 2024 · 0 comments

Comments

@PaulCombal
Copy link

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 .."

@PaulCombal PaulCombal changed the title Deprecated decorator? Autowire attribute Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant