3

I'm trying to make a depend module A to module B using tag in module's config file. But if I disabling module B, module A is still working. How one can fully define dependency in Magento 2?

In general: what is the difference between "Soft Dependency" and "Hard Dependency" in Magento 2?

2

In module.xml you can define only sequence of module loading, not dependencies of modules.

Dependencies of modules are defined in composer.json. Hard in section require, soft in section suggest

See Magento 2 official documentation for more info.

  • I thought composer is not being checked when magento is running codes. Does magento checks composer.json each time a page request being processed ? – Michel Gokan May 4 '16 at 6:24
  • No, it's checks only on cli commands that can install/uninstall disable/enable module, like bin/magento module:disable. Checks at runtime will be to expensive – KAndy May 4 '16 at 6:33
  • How can I depend my module in another in inside my module folder ? Is there anyway or I should edit global composer.json ? – Michel Gokan May 4 '16 at 8:45
  • module still working even after I added the require depndency in composer.json :/ – Michel Gokan May 4 '16 at 19:50
  • As KAndy said, M2 does not check dependencies at runtime. If you disable a dependency, you might get errors, but you won't get any 'missing dependency' fatal error like you would in M1. – Ryan Hoerr May 5 '16 at 15:13

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.