Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Show injected services for iterator and array arguments#31353

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@jschaedl
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#31340
LicenseMIT
Doc PRtbd.

When I have the following service configuration:

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

Informationfor 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

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

linaori, ro0NL, and Simperfit reacted with thumbs up emojilinaori reacted with hooray emojiro0NL reacted with heart emoji
@jschaedljschaedlforce-pushed thefeature-31340_enhanced-information-debug-container-command branch from2781480 to21f7c9aCompareMay 1, 2019 18:32
@linaori
Copy link
Contributor

Should this be done on 3.4 instead? Currently 3.4 shows 0 instead of X in the iterator. This PR can be seen as a bug fix imo

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedMay 1, 2019
edited
Loading

We're too lax currently merging features as bug fixes, introducing regressions actually. Let's be a bit stricter, this is for master to me too.

jschaedl, linaori, Simperfit, and dmaicher reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas added this to thenext milestoneMay 1, 2019
@linaori
Copy link
Contributor

@nicolas-grekas for the value display, I can agree. The fact that this iterator is showing 0 instead of the actual amount is the initial bug I reported. Perhaps the PR could be split up to put the count fix in 3.4 and the list of services in the master?

@jschaedl
Copy link
ContributorAuthor

@linaori The fact that this iterator is showing 0 in branch3.4 is caused by the usage of a non compiled container in the ContainerDebugCommand (see:https://github.com/symfony/symfony/blob/3.4/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php#L184) as far as I can see it. Therefore the service definitions for the iterable arguments are not resolved and theTaggedIteratorArgument::getValues() is returning an empty array which leads to showing0.

@nicolas-grekas Using a compiled container in the DebugContainerCommand was introduced in#27684 I think to fix this0 issue, we need to do the same in the for3.4.

linaori reacted with thumbs up emoji

@jschaedljschaedlforce-pushed thefeature-31340_enhanced-information-debug-container-command branch fromcc3c5d2 todb5fb20CompareMay 5, 2019 20:14
@fabpot
Copy link
Member

Thank you@jschaedl.

jschaedl reacted with hooray emoji

@fabpotfabpot merged commitdb5fb20 intosymfony:masterMay 6, 2019
fabpot added a commit that referenced this pull requestMay 6, 2019
…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     <!-- seehttps://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````bashInformation 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````bashInformation 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
@fabpotfabpot mentioned this pull requestMay 9, 2019
$argumentsInformation[] =\is_array($argument) ?sprintf('Array (%d element(s))',\count($argument)) :$argument;
if (\is_array($argument)) {
foreach (array_keys($argument)as$service) {
$argumentsInformation[] =sprintf('- %s',$service);
Copy link
Member

@nicolas-grekasnicolas-grekasMay 9, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I reverted this part in7a53e8d as I don't see how listing keys can be useful.

}elseif ($argumentinstanceof IteratorArgument) {
$argumentsInformation[] =sprintf('Iterator (%d element(s))',\count($argument->getValues()));
foreach (array_map(function (Reference$value) {return (string)$value; },$argument->getValues())as$service) {
$argumentsInformation[] =sprintf('- %s',$service);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

since this is a reference, it should be displayed asService(%s)
fixed in7a53e8d too

@nicolas-grekasnicolas-grekas modified the milestones:next,4.4Oct 27, 2019
@jschaedljschaedl deleted the feature-31340_enhanced-information-debug-container-command branchFebruary 23, 2020 08:01
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@jschaedl@linaori@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp