nerdexam
Adobe

AD0-E716 · Question #5

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…

The correct answer is B. The extension attribute references the repository instead of the interface it implements. The extension attribute is referencing the repository instead of the interface it implements. The correct XML snippet should be: <extension_attributes> <attribute code="custom_values" type="string[]" translate="true"> <description>This attribute stores an array of custom values…

Customization

Question

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?

Options

  • AThe extension attribute references the wrong interface, it should have referenced the
  • BThe extension attribute references the repository instead of the interface it implements
  • CThe type is wrong, string [] should be replaced with array.

How the community answered

(21 responses)
  • A
    19% (4)
  • B
    76% (16)
  • C
    5% (1)

Explanation

The extension attribute is referencing the repository instead of the interface it implements. The correct XML snippet should be: <extension_attributes> <attribute code="custom_values" type="string[]" translate="true"> <description>This attribute stores an array of custom values for the invoice.</description> <source_model>Magento\Sales\Api\Data\InvoiceInterface</source_model> </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 Magento\Sales\Api\Data\InvoiceInterface

Topics

#extension attributes#extension_attributes.xml#interface reference#API extension

Community Discussion

No community discussion yet for this question.

Full AD0-E716 Practice