U.S. Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe AD0-E716 Exam - Topic 2 Question 57 Discussion

An Adobe Commerce developer is developing a custom module. As part of their implementation they have decided that all instances of their Custom\Module\Model\Example class should receive a new instance of Magento\Filesystem\Adapter\Local.How would the developer achieve this using di. xml?A)B)C)
B) Option B
A) Option A
C) Option C

Adobe AD0-E716 Exam - Topic 2 Question 57 Discussion

Actual exam question for Adobe's AD0-E716 exam
Question #: 57
Topic #: 2
[All AD0-E716 Questions]

An Adobe Commerce developer is developing a custom module. As part of their implementation they have decided that all instances of their Custom\Module\Model\Example class should receive a new instance of Magento\Filesystem\Adapter\Local.

How would the developer achieve this using di. xml?

A)

B)

C)

Show Suggested Answer Hide Answer
Suggested Answer: B

The developer can achieve this by adding the following configuration to their di.xml file:

XML

<config>

<component name='CustomModuleModelExample' factory='CustomModuleModelExampleFactory'>

</component>

</config>

This configuration will ensure that all instances of the CustomModuleModelExample class will receive a new instance of the MagentoFilesystemAdapterLocal class.


Contribute your Thoughts:

0/2000 characters
Eulah
1 month ago
I think Option B is the way to go!
upvoted 0 times
...
Curt
1 month ago
Option A looks correct to me.
upvoted 0 times
...
Emmanuel
2 months ago
I feel like I might be mixing up the syntax for preferences and virtual types. This is tricky!
upvoted 0 times
...
Denae
2 months ago
I'm leaning towards Option B, but I can't recall if we need to use `` for the constructor parameters.
upvoted 0 times
...
Izetta
2 months ago
I practiced a similar question where we had to inject a different class, and I think it involved using the `` tag.
upvoted 0 times
...
Skye
3 months ago
I think I remember that we need to define the preference in di.xml, but I'm not entirely sure how to specify the arguments correctly.
upvoted 0 times
...

Save Cancel