G
G
grabbee2021-12-03 00:25:50
symfony
grabbee, 2021-12-03 00:25:50

How to use nested bundles correctly?

I want to install one (A) bundle in the (APP) application, which expands (complements) (B) another inside. They are very similar, they just complement each other. Only (B)bundle can work independently. (A)bundle is rigidly dependent on (B)bundle and is its more functional version.

Do I understand correctly that I need to actually duplicate the configuration of (B) another bundle in the (A) bundle. Then, in (A)Extension , through (A)CompilerPassInterface , change the parameters of this (B)bundle to the new ones that came from the (A)bundle configuration.

Then in the (APP)application itself, I will need to install and configure only one (A)bundle and not use (APP)Extension at all

Am I doing it right? :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2021-12-03
@myks92

The question in the title is about the use, but inside it is about the union ...)
Without code, it's hard to say what is better to transfer. You can also expand one bundle in different ways, somewhere just copy the class from one and transfer it to another, then replace it in the DI container, climb through events somewhere, and somewhere solve the issue by inheritance.
If we are talking about a bundle, then by all the rules it is probably some kind of public library. Since it makes no sense to make bundles in your application. Therefore, it seems to me that it is worth making a fork of this library, transferring all the necessary dependencies from A to B, and including the library from this fork.
Also, I would try to make a pull request with your add-ons, maybe they will be included in the main bundle.
I don’t see the point in transferring from B to A, since there will obviously be more code, since B works independently, and A depends on it.
I also don't see anything wrong with one bundle depending on another. Bundle A can live without merging with bundle B. The main thing is to keep your dependencies updated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question