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

Clarification of use #18

Open
d42ohpaz opened this issue Dec 11, 2019 · 5 comments
Open

Clarification of use #18

d42ohpaz opened this issue Dec 11, 2019 · 5 comments

Comments

@d42ohpaz
Copy link

Hello. I ran across your bundle, and I was trying to understand what problem it is solving.

Bundles should as well force other Bundles to be instanced in the application to comply with Dependency Injection dependencies.

I do use Symfony 4.4, and autowiring/autoconfigure, and I'm not sure if your bundle applies in my situation as it sounds like those two features do what your bundle does... or am I missing something else altogether?

I apologize if I sound dense; I hope I'm making sense. Would you be able to shed some light on this for me?

Thank you!

@mmoreram
Copy link
Owner

Hello!

This is not a bundle, but a library.
It solves basically the dependency between bundles.
Say to enable bundle A, I need bundle B, basically because service Y from bundle B needs to be defined as is injected in service X.
So, that means that if you instance bundle A, but not bundle B, then service Y will not be found, and application will break.
This library adds a small interface to bundle A (the class bundle) that will define that needs to instance B before A. In your kernel you will add only bundle A, and this library will take care of instancing bundle B before :)

Hope it helped.

@mmoreram
Copy link
Owner

BTW, even if autowiring is enable, services should exist. Autowiring just guess the configuration by checking the parameters types. That's it.

@d42ohpaz
Copy link
Author

I think I understand what the library is meant to do, but what I'm getting stuck on is this is what Symfony's DI already does:

  1. Add dependencies to composer.json
  2. Add the dependency to the config/bundles.php
    • Optionally define which environment(s) the bundle should be loaded
  3. If needed, define any tags, parameters, etc in the services.yaml

Does this mean that your library takes out steps 2 & 3 and figures all of that out automatically? Or am I still missing the point?

Thank you for helping me understand all of this. :)

@ghost
Copy link

ghost commented Sep 23, 2020

I think I understand what the library is meant to do, but what I'm getting stuck on is this is what Symfony's DI already does:

  1. Add dependencies to composer.json

  2. Add the dependency to the config/bundles.php

    • Optionally define which environment(s) the bundle should be loaded
  3. If needed, define any tags, parameters, etc in the services.yaml

Does this mean that your library takes out steps 2 & 3 and figures all of that out automatically? Or am I still missing the point?

Thank you for helping me understand all of this. :)

Bump.

Would also like to know

@mmoreram
Copy link
Owner

@9ae8sdf76 @ReardGj

This library only loads the bundles that your bundle requires - Step 2
Step 3 is still something you have to define manually, but in terms of dependencies, if your bundle A requires B, then A should configure B by using a compiler pass instead of manual configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants