Exam4Training

After a while, their technical manager reviews their work and notices something wrong with the extension_attributes. xml file that the developer created in their module: What is the problem with this xml snippet?

An Adobe Commerce developer adds a new extension attribute to add an array of values to the invoices that are fetched through the APIs.

After a while, their technical manager reviews their work and notices something wrong with the extension_attributes. xml file that the developer created in their module: What is the problem with this xml snippet?
A . The extension attribute references the wrong interface, it should have referenced the MagentosaiesApidatainvoiceinterface.
B. The extension attribute references the repository instead of the interface it implements (MagentosaiesApiinvoiceRepositorymterface).
C. The type is wrong, string [] should be replaced with array.

Answer: B

Explanation:

The extension attribute is referencing the repository instead of the interface it implements.

The correct XML snippet should be:

XML

<extension_attributes>

<attribute code="custom_values" type="string[]"

group="General"

translate="true">

<description>This attribute stores an array of custom values for the invoice.</description> <source_model>MagentoSalesApiDataInvoiceInterface</source_model>

</attribute>

</extension_attributes>

The source_model attribute specifies the interface that the extension attribute is associated with. In this case, the extension attribute is associated with the MagentoSalesApiDataInvoiceInterface interface.

Exit mobile version