!tagged service not working
See original GitHub issueI have a DataProvider with constructor like this.
public function __construct(EntityManagerInterface $manager, iterable $extension)
registered as service
pablo.data_provider.project_data_provider:
class: 'PabloBundle\DataProvider\ProjectDataProvider'
arguments:
- '@doctrine.orm.entity_manager'
- !tagged 'api_platform.doctrine.orm.query_extension.item'
tags:
- { name: 'api_platform.collection_data_provider', priority: 1 }
- { name: 'api_platform.item_data_provider', priority: 2 }
but I always get this error
Cannot autowire service “PabloBundle\DataProvider\ProjectDataProvider”: argument “$extension” of method “__construct()” is type-hinted “iterable”, you should configure its value explicitly.
I just followed the docs written here -> https://api-platform.com/docs/core/data-providers#injecting-extensions-pagination-filter-eagerloading-etc
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Android App Troubleshooting - Knowledge Base
If you continue to experience an app problem after updating to the current version, some issues may occur due to a networking issue...
Read more >Tagged.com - Is Tagged Down Right Now?
Tagged down? Check whether Tagged.com server is down right now or having outage problems for everyone or just for you.
Read more >Reference Tagged Services cannot be resolved - Stack Overflow
You want to add a custom tag and inject all services in your parent service. You have a syntax error, the argument _instanceof...
Read more >Troubleshoot issues related to tagging tasks in Amazon ECS
If you are unable to add tags to your ECS service, do the following: ... Confirm that your ECS tags are within the...
Read more >Reference Tagged Services combined with Autoconfiguring ...
Symfony version(s) affected: 4.3.11 Description Reference Tagged Services combined with Autoconfiguring Tags does not work How to reproduce ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Solved it on my own, but learned a lot during this, see https://stackoverflow.com/a/56655789/5330805
Viele Grüße, Olli Demetz
Von meinem iPhone gesendet
When you define your service like this
you are creating a new service which id is
report_helper, Try to debug the containeryou will find your service but with
report_helperid, so unless you tried to override your controller definition in service.yaml and pass it the correct service like thisIt won’t work as the service container wouldn’t be able to detect what do you mean by
iterable, because it’s trying to using the service which he autowired automatically.So the solution is what @flaushi says you can use
aliasto be like thisOr you can use alias directly by using it as service id like this