8000 Teach the user to write the command lazy loading by SimonHeimberg · Pull Request #10460 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Teach the user to write the command lazy loading #10460

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 2 commits into from

Conversation

SimonHeimberg
Copy link
Contributor

A lazy loaded command is instantiated only when it is called.

A lazy loaded command is instantiated only when it is called.
@SimonHeimberg
Copy link
Contributor Author

@ndench
Copy link
Contributor
ndench commented Oct 29, 2018

Are lazy loaded commands better in every situation? Should this contain a link to the commands_as_services docs?

@xabbuh xabbuh added this to the 3.4 milestone Nov 6, 2018
@SimonHeimberg
Copy link
Contributor Author

A link to https://symfony.com/doc/current/console/commands_as_services.html#lazy-loading sounds good, @ndench. Where should its place be?

I do not know if lazy loading is a good idea in all situations. As mentioned in commands_as_services, ->addAlias() must be handled. Any suggestions of situations?

@xabbuh
Copy link
Member
xabbuh commented Nov 7, 2018

I think I would not add the link. This is just working and adding a cross-reference to another article may be more confusing.

@ndench
Copy link
Contributor
ndench commented Nov 7, 2018

I'm not fussed either way. As long as there is somewhere in the docs that explain that lazy loading isn't the only way to write commands.

@kunicmarko20
Copy link
Contributor

Maybe instead of replacing the non lazy way, add another example under it where the lazy load is mentioned with a static property?

@nicolas-grekas
Copy link
Member

This should really be the way to go 99% of the time

@xabbuh
Copy link
Member
xabbuh commented Nov 30, 2018

Thank you @SimonHeimberg.

xabbuh added a commit that referenced this pull request Nov 30, 2018
…eimberg)

This PR was submitted for the 4.1 branch but it was squashed and merged into the 3.4 branch instead (closes #10460).

Discussion
----------

Teach the user to write the command lazy loading

A lazy loaded command is instantiated only when it is called.

Commits
-------

4706701 Teach the user to write the command lazy loading
@xabbuh xabbuh closed this Nov 30, 2018
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.

8 participants
0