Skip to content

container:debug CLI output improvements for excluded services #48606

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

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

apfelbox
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? no
New feature? yes (not sure)
Deprecations? no
Tickets
License MIT
Doc PR

Normally I test whether the exclusion rules from the service container of my bundles work correctly by just using the debug:container command and looking whether my excluded services occur in the last.
However, due to the latest changes in #46279 all services (excluded or not) are always in this list.

You need to open the definition to see if it was excluded:

CleanShot 2022-12-12 at 11 01 08

This PR proposes two things:

  1. add a more prominent warning to the service definition details screen that the service is excluded

CleanShot 2022-12-12 at 11 01 52
(wording tbd)

  1. mark the services as excluded in the list (right now by graying them out):

CleanShot 2022-12-12 at 11 02 44

If this looks like something you want to include, I will add the "graying out" part to the table view as well.
wdyt?

@carsonbot carsonbot added this to the 6.3 milestone Dec 12, 2022
@apfelbox apfelbox changed the title Container debug improvements [FrameworkBundle] Container debug improvements Dec 12, 2022
@apfelbox apfelbox changed the title [FrameworkBundle] Container debug improvements [FrameworkBundle] container:debug CLI output improvements for excluded services Dec 12, 2022
@apfelbox apfelbox force-pushed the container-debug-improvements branch from c27c7fc to e92e0b5 Compare December 12, 2022 10:06
@nicolas-grekas
Copy link
Member

Good catch. I'd suggest being more aggressive and just not list those services, and do it on 6.2. WDYT?

@apfelbox
Copy link
Contributor Author

@nicolas-grekas I think your proposal would make even more sense: no point in showing the service details for a class that is not, well, a service. 😄 Will update my PR for that 👍

@apfelbox apfelbox force-pushed the container-debug-improvements branch from e92e0b5 to 6e96730 Compare December 12, 2022 10:18
@apfelbox apfelbox changed the base branch from 6.3 to 6.2 December 12, 2022 10:19
@apfelbox
Copy link
Contributor Author

@nicolas-grekas so I updated the implementation: now based on 6.2 and I just excluded the services from the choice list.

However a probably better implementation would be to add a ContainerBuilder::getNonExcludedServiceIds() (naming tbd) and just use that? This way it would also more or less directly work in the table view of this command.

And if we go that route, should I just look up every definition in this call and check or is there a smarter way?

@nicolas-grekas nicolas-grekas force-pushed the container-debug-improvements branch from 6e96730 to 9d2f10f Compare December 14, 2022 14:36
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM as is, no need for more APIs.

@nicolas-grekas
Copy link
Member

Thank you @apfelbox.

@carsonbot carsonbot changed the title [FrameworkBundle] container:debug CLI output improvements for excluded services container:debug CLI output improvements for excluded services Dec 14, 2022
@nicolas-grekas nicolas-grekas merged commit 2c632f0 into symfony:6.2 Dec 14, 2022
@apfelbox apfelbox deleted the container-debug-improvements branch December 15, 2022 08:09
@apfelbox
Copy link
Contributor Author

@nicolas-grekas the drawback of not adding a new API is that the call without a filter

php bin/console debug:container

will still list them. This call doesn't go through this method, but instead through the descriptors (and they call $builder->getServiceIds() directly).

Should we ignore that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants