Skip to content
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

Question: Why do we need to register migration commands as services with a factory? #29

Open
thexpand opened this issue Jun 29, 2020 · 6 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@thexpand
Copy link

I tested the migrations functionality with and without registering the migrations commands inside the factories. It works even without registering them, when I try to call php vendor/bin/doctrine-migrations xxxxx, where xxxxx is the command. So, why do we need to register the commands as services?

@asgrim
Copy link
Member

asgrim commented Jul 14, 2020

It's been a while since I looked at that; if we can verify the service configuration really isn't needed, then it should be removed from docs 👍

@asgrim asgrim added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Jul 14, 2020
@thexpand
Copy link
Author

I tried to search for a code that uses these services in the whole project, but I can't find one. How can we verify this for sure?

@asgrim
Copy link
Member

asgrim commented Sep 17, 2020

@thexpand the example is just "how you might configure it in your project". If you don't need/want to register your commands as services, then that is fine, just skip that step. Perhaps clarification on the docs would help :)

@asgrim
Copy link
Member

asgrim commented Sep 17, 2020

I tried to search for a code that uses these services in the whole project, but I can't find one. How can we verify this for sure?

Oh and you won't find any services used in this project, if that's what you mean? This library does not consume services, it only provides factories so you can wire them into your container.

@thexpand
Copy link
Author

@asgrim Ah, I understand now. But why would you need them as services in the first place? Can you give me an example of a possible scenario for this? The only possible use case I can think of is to execute a migration command in another symfony-console custom command that I have in the application.

@asgrim
Copy link
Member

asgrim commented Sep 17, 2020

Generally when using symfony/console, using a container allows you to configure (manually, I don't think it's out the box, can't remember) lazy-loading services meaning unused dependencies aren't initiated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants