1

I would like to know if all dependency injections used in a module have to be declared in the "module dependencies".

And, in this case, as "soft" dependencies (in module.xml file), as "hard" dependencies (in composer.json file) or both?

In my studies I learned they have to be added in composer.json file.. am I right?

3

If you use any class/interface from a module other than your's you need to declare that in composer.json.
module.xml does not contain dependencies.
It only holds the list of modules that should be loaded before your module. Even if you add there a module that does not exist, your module will still run properly.

  • Ok, the answer is: simplifying, I have to add DI in composer file. For module.xml I know "it only holds the list of modules that should be loaded before your module. Even if you add there a module that does not exist, your module will still run properly" but in Magento documentation it is known as "Soft Dependency". In any case, I discovered it is useless to insert add DI in module.xml.. – WaPoNe Jan 19 '17 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.