QuestionQ20

Adobe Commerce Architecture and Customization Techniques

An Adobe Commerce developer is building a custom module. As part of the implementation, they have decided that every instance of their Custom\Module\Model\Example class must receive a new instance of Magento\Filesystem\Adapter\Local.

How can the developer accomplish this with di.xml?

  • A
  • B
  • C
Explanation

For an object constructor argument in Adobe Commerce di.xml, shared="false" sets a transient lifestyle. The object manager therefore creates a separate Magento\Filesystem\Adapter\Local instance for each Custom\Module\Model\Example instance, rather than reusing a shared instance.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!