Skip to content

[Console] Commands auto-registration is deprecated #8269

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
wants to merge 4 commits into from

Conversation

GuilhemN
Copy link
Contributor

@GuilhemN GuilhemN commented Aug 9, 2017

Document symfony/symfony#23805.

I wonder, should I update https://github.com/symfony/symfony-docs/blob/17d1c39298e9415886e2c712748d3021ed7865a4/bundles/best_practices.rst L122 (Command/ Yes) ? As it is not really mandatory to use the Command/ directory anymore.

console.rst Outdated
@@ -38,6 +38,19 @@ For example, a command called ``CreateUser`` must follow this structure::
}
}

If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
Copy link
Member

Choose a reason for hiding this comment

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

Considering that this is the Console article, this explanation about services may be a bit advanced and/or confusing. Imagine you are a user reading the article: you just want to create and run some commands. You don't even need to know what a service is.

So, why don't we reword the first paragraph to tell the user something like this:

Symfony registers any PHP class extending from Command as a console command automatically, so you can now execute this command as ........

And keep the mention of services and tags for the .. note.

Copy link
Contributor Author

@GuilhemN GuilhemN Aug 10, 2017

Choose a reason for hiding this comment

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

I like the idea! However I'm not sure I did exactly what you wanted, can you check?

console.rst Outdated
@@ -64,12 +64,26 @@ method. Then you can optionally define a help message and the
Executing the Command
---------------------

After configuring the command, you can execute it in the terminal:
Symfony registers any PHP class extending from :class:`Symfony\\Component\\Console\\Command\\Command`
Copy link
Member

Choose a reason for hiding this comment

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

from

console.rst Outdated
@@ -64,12 +64,26 @@ method. Then you can optionally define a help message and the
Executing the Command
---------------------

After configuring the command, you can execute it in the terminal:
Symfony registers any PHP class extending from :class:`Symfony\\Component\\Console\\Command\\Command`
as a console command automatically, so you can now execute this command in the
Copy link
Member

Choose a reason for hiding this comment

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

[...] automatically. So you [...]

console.rst Outdated

Otherwise, Symfony looks in the ``Command/`` directory of bundles for commands
non registered as a service but this is deprecated since Symfony 3.4 and
won't be supported in Symfony 4.0.
Copy link
Member

@xabbuh xabbuh Aug 11, 2017

Choose a reason for hiding this comment

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

Maybe we should move this whole paragraph into a caution block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@robfrawley
Copy link
Contributor

robfrawley commented Aug 14, 2017

The text on line 19 of console.rst should contain the phrase "a user," not "an user" (the latter being grammatically incorrect).

For example, you may want a command to create an user a user:

You can reference this article on the subject, with the relevant information summarized below.

"An" goes before all words that begin with vowels (for example "an egg" or "an ugly dog"), with two exceptions.

  1. When "u" makes the same sound as the "y" in you.
  2. When "o" makes the same sound as "w" in won.

For these exceptions, "a" is used instead:

  • a union
  • a united front
  • a unicorn
  • a used napkin
  • a U.S. ship
  • a one-legged man
  • a user

@GuilhemN
Copy link
Contributor Author

@robfrawley I didn't know that, thanks for the explanation! It's fixed now.

@xabbuh xabbuh added this to the 3.4 milestone Sep 3, 2017
@xabbuh
Copy link
Member

xabbuh commented Sep 3, 2017

Thank you @GuilhemN.

xabbuh added a commit that referenced this pull request Sep 3, 2017
…emN)

This PR was squashed before being merged into the 3.4 branch (closes #8269).

Discussion
----------

[Console] Commands auto-registration is deprecated

Document symfony/symfony#23805.

I wonder, should I update https://github.com/symfony/symfony-docs/blob/17d1c39298e9415886e2c712748d3021ed7865a4/bundles/best_practices.rst L122 (`Command/  Yes`) ? As it is not really mandatory to use the `Command/` directory anymore.

Commits
-------

493ae89 [Console] Commands auto-registration is deprecated
xabbuh added a commit that referenced this pull request Sep 3, 2017
@xabbuh
Copy link
Member

xabbuh commented Sep 3, 2017

I wonder, should I update https://github.com/symfony/symfony-docs/blob/17d1c39298e9415886e2c712748d3021ed7865a4/bundles/best_practices.rst L122 (Command/ Yes) ? As it is not really mandatory to use the Command/ directory anymore.

I think we should take that into account in #7156

@xabbuh xabbuh closed this Sep 3, 2017
xabbuh added a commit that referenced this pull request Sep 3, 2017
* 3.4: (42 commits)
  [#8273] fix bundle registration code
  [#8273] minor rewording
  Reworded the built-in web server articles for Symfony 3.3
  fix diff code block highlighting
  [#8269] minor rewording
  [Console] Commands auto-registration is deprecated
  [#8231] fix reStructuredText syntax
  Specified import order of config files
  [#7981] revert some changes
  Update upload_file.rst
  Update usage.rst
  Update doctrine.rst
  Update usage.rst
  [#8260] add missing redirection map entry
  Delete use_virtuals_forms.rst
  Added a missing redirection
  Update validation_group_service_resolver.rst
  Update redirection_map
  Update button_based_validation.rst
  Delete group_service_resolver.rst
  ...
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.

6 participants