Home » Magento » Magento 2 Certified Associate Developer » Where should the dependency be declared?
You are writing a customization for the customer module. You need to make sure the configuration files from your module are loaded after the customer module’s configuration.
Where should the dependency be declared?
A. composer.json
B. etc/module.xml
C. etc/config.xml
D. etc/di.xml
Correct Answer: A
Explanation/Reference:
Reference: https://devdocs.magento.com/guides/v2.3/architecture/archi_perspectives/components/modules/mod_depend.html
Download Printable PDF. VALID exam to help you PASS.
|
|
B is correct. tag is used to tell magento which modules should be loaded before yours.
Composer won’t secure the loading sequence, instead will tell you what modules are required (require tag) for the proper function of your module. By using suggest tag on composer, you just give information about what module would add extra functionality to yours (they are not mandatory to be installed).
Answer : B
Composer only use installation time
I think the answer should be B because in the link given below, a line is mentioned:
“The list is an optional element and is applied only in case other modules are involved and you need to indicate files load dependencies.”
In the question also, file dependency is mentioned specifically.
https://amasty.com/blog/magento-2-certification-module-based-architecture/
Answer is B
A and B both correct. Either use the suggest part of composer or declare the dependency in the module.xml https://devdocs.magento.com/guides/v2.4/architecture/archi_perspectives/components/modules/mod_depend.html
Could also be B couldnt it?