Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - 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
Laine
4 days ago
Complexity can lead to issues later.
upvoted 0 times
...
Jose
9 days ago
True, but A is less complex.
upvoted 0 times
...
Sunny
14 days ago
Agreed! A might miss some details.
upvoted 0 times
...
Laine
20 days ago
A has its merits, but B feels more complete.
upvoted 0 times
...
Jose
25 days ago
I prefer Option A. It looks more straightforward to me.
upvoted 0 times
...
Sunny
30 days ago
It seems to properly configure the dependency injection.
upvoted 0 times
...
Laine
1 month ago
Why B?
upvoted 0 times
...
Sunny
1 month ago
Definitely! I lean towards Option B.
upvoted 0 times
...
Laine
2 months ago
I think this question is tricky.
upvoted 0 times
...
Yoko
2 months ago
I’m surprised they didn’t mention constructor injection!
upvoted 0 times
...
Ciara
2 months ago
Wait, why would they need a new instance for every class?
upvoted 0 times
...
Melodie
2 months ago
Not sure about that, Option C seems off.
upvoted 0 times
...
Eulah
4 months ago
I think Option B is the way to go!
upvoted 0 times
...
Curt
4 months ago
Option A looks correct to me.
upvoted 0 times
...
Emmanuel
4 months ago
I feel like I might be mixing up the syntax for preferences and virtual types. This is tricky!
upvoted 0 times
...
Denae
5 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
5 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
5 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