-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DIC] !tagged tag list not showing with --show-arguments in debug:container #31340
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
Comments
In However if you use Information for Service "my_service"
====================================
---------------- -------------------------
Option Value
---------------- -------------------------
Service ID my_service
Class stdClass
Tags -
Public no
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired yes
Autoconfigured yes
Arguments Iterator (2 element(s))
---------------- ------------------------- I tried to introduce a compiled container also in debug mode, but got a lot of failing tests. Fixing all the related fixtures and tests feels not like a small bugfix to me and I doubt that something, like this will get merged. So I suggest we remove the number of elements information, when someone executes the command in debug mode. WDYT? |
Would it be an idea to show the name of the tagged iterator instead? That information is available if I recall correctly. If you can see which tag you insert, you can do a
|
…and array arguments (jschaedl) This PR was merged into the 4.3-dev branch. Discussion ---------- [FrameworkBundle] Show injected services for iterator and array arguments | Q | A | ------------- | --- | Branch? | master | Bug fix? |no | New feature? | yes<!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? |no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #31340 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | tbd. When I have the following service configuration: ```yaml App\Word\Checker\StaticWordChecker: tags: [app.checker] App\Word\Checker\BannedWorldListChecker: tags: [app.checker] App\Word\WordCheckerTaggedIterator: arguments: [!tagged app.checker] App\Word\WordCheckerArray: arguments: - App\Word\Checker\StaticWordChecker: ~ App\Word\Checker\BannedWorldListChecker: ~ ``` and I run: `./bin/console debug:container App\Word\WordCheckerArray --show-arguments` ```bash Information for Service "App\Word\WordCheckerArray" =================================================== ---------------- ------------------------------------------- Option Value ---------------- ------------------------------------------- Service ID App\Word\WordCheckerArray Class App\Word\WordCheckerArray Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Array (2 element(s)) - App\Word\Checker\StaticWordChecker - App\Word\Checker\BannedWorldListChecker ---------------- ------------------------------------------- ``` or `./bin/console debug:container App\Word\WordCheckerTaggedIterator --show-arguments` ```bash Information for Service "App\Word\WordCheckerTaggedIterator" ============================================================ ---------------- ------------------------------------------- Option Value ---------------- ------------------------------------------- Service ID App\Word\WordCheckerTaggedIterator Class App\Word\WordCheckerTaggedIterator Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Iterator (2 element(s)) - App\Word\Checker\BannedWorldListChecker - App\Word\Checker\StaticWordChecker ---------------- ------------------------------------------- ``` I can now see the the objects injected into the iterator and array arguments. Commits ------- db5fb20 [FrameworkBundle] Show injected services for Iterator and Array
…(jschaedl) This PR was squashed before being merged into the 3.4 branch (closes #31371). Discussion ---------- [DI] Removes number of elements information in debug mode | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31340 | License | MIT | Doc PR | - With this services config: ```yaml my_service: class: stdClass arguments: [!tagged my_tag] my_tagged_service_1: class: stdClass tags: [my_tag] my_tagged_service_2: class: stdClass tags: [my_tag] ``` Executing `./bin/console debug:container my_service --show-arguments --env=dev` resulted in ```bash Information for Service "my_service" ==================================== ---------------- ------------------------- Option Value ---------------- ------------------------- Service ID my_service Class stdClass Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Iterator (0 element(s)) ---------------- ------------------------- ``` With this fix the output changed to: ```bash Information for Service "my_service" ==================================== ---------------- ------------ Option Value ---------------- ------------ Service ID my_service Class stdClass Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Tagged Iterator for "my_tag" ---------------- ------------ ``` and with `./bin/console debug:container my_service --show-arguments --env=prod` ```bash Information for Service "my_service_tagged_iterator" ==================================================== ---------------- --------------------------------------------- Option Value ---------------- --------------------------------------------- Service ID my_service Class stdClass Tags - Public no Synthetic no Lazy no Shared yes Abstract no Autowired yes Autoconfigured yes Arguments Tagged Iterator for "my_tag" (2 element(s)) ---------------- --------------------------------------------- ``` Commits ------- 0da4b83 [DI] Removes number of elements information in debug mode
Symfony version(s) affected: 3.4+
Description
When using
bin/console debug:container my_service --show-arguments
and this service contains an argument as!tagged my_tag
, it will not properly show the arguments being passed. The XML will only contain a "tagged" element and doesn't tell you which services will be injected. The command line output will tell you there are 0 elements in the iterator.How to reproduce
To verify the services are actually there:
Missing argument information:
Possible Solution
I would personally already be satisfied if it properly displayed the actual count, and it would be even better if it could display the list of service_ids it would inject.
This is currently making it a bit troublesome to see if your
!tagged
works and in a more complex system (autoconfigure), if all the services are picked up correctly.The text was updated successfully, but these errors were encountered: