AD0-E722 practice question 6 of 10
In a custom module, an Architect wants to define a new xml configuration file. The module should be able to read all the xml configuration files declared in the system, merge them together, and use their values in PHP class. Which two steps should the Architect make to meet this requirement? (Choose two.)
Full set: 50 questionsTo implement a new, merged XML configuration in Magento, an Architect must first create a Reader class. This class, typically extending \Magento\Framework\Config\Reader\Filesystem, is responsible for discovering and reading all XML files of a specific name from every enabled module (Option E). Secondly, this Reader must be configured via di.xml to pass the parsed data into a data-handling object, which is an instance of \Magento\Framework\Config\Data or its subclass. This is accomplished by injecting the custom Reader as a dependency into the Data object's definition in di.xml (Option A). These two steps establish the core mechanism for reading, merging, and making the configuration data available for use. Why Incorrect Options are Wrong
B. Write a plugin for \Magento\Framework\Config\Data::get() and read the custom xml files A plugin on the get() method intercepts data retrieval. It is not the correct mechanism for the initial loading and merging of configuration files.
C. Create a Data class that implements "\Magento\Framework\Config\Data" This is not strictly required. A virtual type of the base \Magento\Framework\Config\Data class can be defined in di.xml to achieve the same result without creating a new PHP class file.
D. Append the custom xml file name in "Magento\Config\Model\Config\Structure\Reader" in di.xml This Reader is specifically for processing system.xml files. Modifying it for a different, custom configuration type is incorrect and would likely disrupt core system configuration. References
1. Adobe Commerce Developer Guide, "Create a custom configuration type": This official guide outlines the full process. Reference for E: The section "Create a config reader" explicitly states: "The configuration reader class is responsible for reading all configuration files... and must extend \Magento\Framework\Config\Reader\Filesystem." Reference for A: The section "Define the configuration object" provides an example di.xml where the custom Reader is injected as a constructor argument into the Data class: . This directly supports injecting the reader dependency.
2. Adobe Commerce Developer Guide, "Virtual types": This document explains how virtual types can be used to customize constructor arguments for a class without creating a subclass. Reference for why C is incorrect: "You can use virtual types to change the arguments of a specific injectable class." This confirms that a new Data class file is not mandatory; a virtual type of Magento\Framework\Config\Data can be configured with the custom Reader, making option C an optional (though common) practice rather than a required step.
Keep practicing
Take the free AD0-E722 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other AD0-E722 practice questions
- Question 3An Architect needs to integrate an Adobe Commerce store with a new Shipping Carrier. Cart…
- Question 4Due to a marketing campaign, a website is experiencing a very large number of simultaneou…
- Question 7A merchant is using a unified website that supports native Adobe Commerce B2B and B2C wit…
- Question 8An Adobe Commerce Architect is asked by a merchant using B2B features to help with a conf…
- Question 9An Adobe Commerce Architect is troubleshooting an issue on an Adobe Commerce Cloud projec…
