8000 app/console list finds a namespace ambiguous if it only consists of sub-namespaces · Issue #10531 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

app/console list finds a namespace ambiguous if it only consists of sub-namespaces #10531

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

Closed
kachkaev opened this issue Mar 25, 2014 · 4 comments
Labels
Bug Console Good first issue Ideal for your first contribution! (some Symfony experience may be required)

Comments

@kachkaev
Copy link

If, for example, a project consists of the following commands:

my-website:admin:do-something
my-website:admin:do-something-else
my-website:data:blah
my-website:data:blah-blah

calling app/console list my-website causes an exception:

 The namespace "my-website" is ambiguous (my-website:admin, my-website:data).

This does not look like what would be expected. Adding a command into my-website namespace directly (e.g. my-website:test) helps to avoid the issue – command listing starts working fine.

Perhaps, the problem is in Symfony\Component\Console\Application::getNamespaces() – this method registers only one namespace per command, so parent namespaces remain unknown unless they contain any commands directly.

@stof stof added Bug labels Mar 25, 2014
@cordoval
Copy link
Contributor

this is a duplicate i believe, just can't recall the issue number, but sure i have ran into this. The logic is messy inside and i believe it lacks tests so is actually tedious to refactor and implement what you said. Basically what we should add to the documentation is we are supporting only one level of : and that is it. It does not have full nth : level support.

@stof
Copy link
Member
stof commented Mar 25, 2014

@cordoval the issue is that multiple levels of : is used by core bundles commands (all Doctrine commands for instance, which is coming from the old times of the Symfony bundles btw). SensioFrameworkExtraBundle relies on it as well.

and most third-party bundles I know are also relying on it to isolate their commands to avoid conficts (fos:user:*, fos:elastica:*, ..., not limited to FOS bundles). So we cannot forbid using several:`` in names (at least not in 2.x)

@habashyjr
Copy link

I think it's pretty easy to solve this little glitch, as @kachkaev mentioned the problem is within Symfony\Component\Console\Application::getNamespaces() which clearly mentions It does not returns the global namespace which always exists. however Symfony\Component\Console\Application::extractNamespace() has a second argument limit which we can pass a flag to getNamespaces() to set limit to 1 whenever app/console list XX is called

@fabpot fabpot added the Good first issue Ideal for your first contribution! (some Symfony experience may be required) label Dec 29, 2014
@nacmartin
Copy link
Contributor

I am having a look at this.

fabpot added a commit that referenced this issue Jan 25, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[Console] fixed 10531

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10531
| License       | MIT
| Doc PR        | -

This is a fix for #10531. It works by extracting all the parent namespaces of a command.

Commits
-------

e6afff4 [Console] fixed #10531
@fabpot fabpot closed this as completed Jan 25, 2015
fabpot added a commit that referenced this issue Jan 25, 2015
* 2.3:
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  Removed dead code and various cleaning
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed #10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
	src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig
	src/Symfony/Component/Console/Tests/ApplicationTest.php
	src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php
fabpot added a commit that referenced this issue Jan 25, 2015
* 2.5:
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  Removed dead code and various cleaning
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed #10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
fabpot added a commit that referenced this issue Jan 25, 2015
* 2.6:
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  Removed dead code and various cleaning
  Removed dead code and various cleaning
  [FrameworkBundle][xsd] added missing logging attribute.
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed #10531
  Make the container considered non-fresh if the environment parameters are changed
fabpot added a commit that referenced this issue Jan 25, 2015
* 2.7:
  fixed tests
  [OptionsResolver] replaced some exception messages
  Added i18n support to ConfirmationQuestion
  [HttpKernel] [WebProfilerBundle] added HTTP status to profiler search result
  [Form] fixed form tests when using 2.7 deps
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  [Routing] merge instead of replace class and method scheme/method annotations
  [TwigBridge] Fix bootstrap rendering when user explicitly use form_label
  Removed dead code and various cleaning
  Removed dead code and various cleaning
  Fixed HtmlDumper with long string
  Removed dead code and various cleaning
  [FrameworkBundle][xsd] added missing logging attribute.
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed #10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
	src/Symfony/Component/HttpKernel/CHANGELOG.md
	src/Symfony/Component/Process/Process.php
ostrolucky pushed a commit to ostrolucky/symfony that referenced this issue Mar 25, 2018
* 2.7:
  fixed tests
  [OptionsResolver] replaced some exception messages
  Added i18n support to ConfirmationQuestion
  [HttpKernel] [WebProfilerBundle] added HTTP status to profiler search result
  [Form] fixed form tests when using 2.7 deps
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  [Routing] merge instead of replace class and method scheme/method annotations
  [TwigBridge] Fix bootstrap rendering when user explicitly use form_label
  Removed dead code and various cleaning
  Removed dead code and various cleaning
  Fixed HtmlDumper with long string
  Removed dead code and various cleaning
  [FrameworkBundle][xsd] added missing logging attribute.
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed symfony#10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
	src/Symfony/Component/HttpKernel/CHANGELOG.md
	src/Symfony/Component/Process/Process.php
jderusse pushed a commit to jderusse/symfony that referenced this issue Dec 15, 2020
* 2.3:
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  Removed dead code and various cleaning
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed symfony#10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
	src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig
	src/Symfony/Component/Console/Tests/ApplicationTest.php
	src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php
jderusse pushed a commit to jderusse/symfony that referenced this issue Dec 15, 2020
* 2.5:
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  Removed dead code and various cleaning
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed symfony#10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
jderusse pushed a commit to jderusse/symfony that referenced this issue Dec 15, 2020
* 2.6:
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  Removed dead code and various cleaning
  Removed dead code and various cleaning
  [FrameworkBundle][xsd] added missing logging attribute.
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed symfony#10531
  Make the container considered non-fresh if the environment parameters are changed
jderusse pushed a commit to jderusse/symfony that referenced this issue Dec 15, 2020
* 2.7:
  fixed tests
  [OptionsResolver] replaced some exception messages
  Added i18n support to ConfirmationQuestion
  [HttpKernel] [WebProfilerBundle] added HTTP status to profiler search result
  [Form] fixed form tests when using 2.7 deps
  [2.3] [HttpFoundation] [MimeTypeGuesser]
  [Routing] merge instead of replace class and method scheme/method annotations
  [TwigBridge] Fix bootstrap rendering when user explicitly use form_label
  Removed dead code and various cleaning
  Removed dead code and various cleaning
  Fixed HtmlDumper with long string
  Removed dead code and various cleaning
  [FrameworkBundle][xsd] added missing logging attribute.
  [Console] Make it clear that the second argument is not about command options.
  Added the '-' character for spaceless on tag start and end to be consistent for block, if, set and for nodes
  [Yaml] fixed parse shortcut Key after unindented collection.
  [Console] fixed symfony#10531
  Make the container considered non-fresh if the environment parameters are changed

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
	src/Symfony/Component/HttpKernel/CHANGELOG.md
	src/Symfony/Component/Process/Process.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Console Good first issue Ideal for your first contribution! (some Symfony experience may be required)
Projects
None yet
Development

No branches or pull requests

6 participants
0