4

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?

1 Answer 1

3

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.

9
  • I thought composer is not being checked when magento is running codes. Does magento checks composer.json each time a page request being processed ? Commented May 4, 2016 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
    Commented May 4, 2016 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 ? Commented May 4, 2016 at 8:45
  • module still working even after I added the require depndency in composer.json :/ Commented May 4, 2016 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
    Commented May 5, 2016 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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