-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Conversation
A lazy loaded command is instantiated only when it is called.
about lazy loading a command: https://symfony.com/doc/current/console/commands_as_services.html#lazy-loading |
Are lazy loaded commands better in every situation? Should this contain a link to the |
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 |
I think I would not add the link. This is just working and adding a cross-reference to another article may be more confusing. |
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. |
Maybe instead of replacing the non lazy way, add another example under it where the lazy load is mentioned with a static property? |
This should really be the way to go 99% of the time |
Thank you @SimonHeimberg. |
…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
A lazy loaded command is instantiated only when it is called.