Exam4Training

A developer is creating a class VendorModuleModelMyModeL How should that class be defined as transient in di.xml?

A developer is creating a class VendorModuleModelMyModeL How should that class be defined as transient in di.xml?
A . <type name="VendorModuleModelMyModer transient="true7>
B. <type name="VendorModuleModelMyModer singleton=’false7>
C. <type name=’VendorModuleModelMyModer shared="false7>

Answer: C

Explanation:

In Magento 2’s di.xml, if you want to define a class as transient (meaning a new instance is created every time it’s requested), you would use the shared attribute and set it to false.

This definition ensures that a new instance of MyModel is created every time it’s requested from the object manager.

Latest AD0-E717 Dumps Valid Version with 77 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version