Skip to content

[FrameworkBundle] Update ContainerDebugCommand to add parial search for tags #47311

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

Conversation

BOB41K1987
Copy link

@BOB41K1987 BOB41K1987 commented Aug 18, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR symfony/symfony-docs#17201

As of now, the debug:container command allows the use of partial search for the service name but doesn't allow the partial search for tags. It can be especially useful when using with #[AutoconfigureTag] attribute when the class FQN becomes a tag.

namespace App\SomeBundle\SomeService\Inerfaces;

use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

#[AutoconfigureTag]
interface SomeInterface{}

As of now, to find the services tagged with this interface we need to execute
bin/console debug:container --tag=App\\SomeBundle\\SomeService\\Inerfaces\\SomeInterface
which looks a bit overwhelming.

This PR allows to search simply by
bin/console debug:container --tag=SomeInterface
which is much simpler.

In case there are multiple tags containing the string, the command will allow choosing the one the user is looking for:

bin/console debug:container --tag=kernel

 Select one of the following tags to display its information:
  [0] kernel.event_listener
  [1] kernel.event_subscriber
  [2] kernel.reset
  [3] kernel.cache_warmer
  [4] kernel.locale_aware
  [5] kernel.fragment_renderer
  [6] kernel.cache_clearer

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

Copy link
Contributor

@94noni 94noni left a comment

Choose a reason for hiding this comment

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

Nice PR

@fabpot
Copy link
Member

fabpot commented Aug 29, 2022

Thank you @BOB41K1987.

fabpot added a commit that referenced this pull request Aug 29, 2022
…parial search for tags (vshevelev, BOB41K1987)

This PR was squashed before being merged into the 6.2 branch.

Discussion
----------

[FrameworkBundle] Update ContainerDebugCommand to add parial search for tags

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | symfony/symfony-docs#17201

As of now, the `debug:container` command allows the use of partial search for the service name but doesn't allow the partial search for `tags`. It can be especially useful when using with `#[AutoconfigureTag]` attribute when the class FQN becomes a tag.
```
namespace App\SomeBundle\SomeService\Inerfaces;

use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

#[AutoconfigureTag]
interface SomeInterface{}
```

As of now, to find the services tagged with this interface we need to execute
`bin/console debug:container --tag=App\\SomeBundle\\SomeService\\Inerfaces\\SomeInterface`
which looks a bit overwhelming.

This PR allows to search simply by
`bin/console debug:container --tag=SomeInterface`
which is much simpler.

In case there are multiple tags containing the string, the command will allow choosing the one the user is looking for:
```
bin/console debug:container --tag=kernel

 Select one of the following tags to display its information:
  [0] kernel.event_listener
  [1] kernel.event_subscriber
  [2] kernel.reset
  [3] kernel.cache_warmer
  [4] kernel.locale_aware
  [5] kernel.fragment_renderer
  [6] kernel.cache_clearer
```

Commits
-------

b301d92 [FrameworkBundle] Update ContainerDebugCommand to add parial search for tags
@fabpot fabpot closed this Aug 29, 2022
@fabpot fabpot force-pushed the feature/Update-ContainerDebugCommand-to-add-partial-search-for-tags branch from 865c757 to b301d92 Compare August 29, 2022 06:42
@fabpot fabpot mentioned this pull request Oct 24, 2022
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.

4 participants