nerdexam
Adobe

AD0-E724 · Question #24

A developer has created an extension attribute for the 'Product' entity. They have correctly defined it in 'etc/extension_attributes.xml'. Now, they need to implement the logic to load and save this a

The correct answer is B. 'getList()' D. 'getById()'. When a product is retrieved from the repository, the developer needs to intercept the returned object and attach the extension attribute data before it reaches the caller. getById() fetches a single product by ID and getList() fetches a collection - these are the two read operati

Customization

Question

A developer has created an extension attribute for the 'Product' entity. They have correctly defined it in 'etc/extension_attributes.xml'. Now, they need to implement the logic to load and save this attribute's data when the product repository is used. Which specific methods of the 'ProductRepositoryInterface' should the developer create "after" plugins for to ensure the extension attribute is consistently available when a product is loaded? (Choose 2.)

Options

  • A'save()'
  • B'getList()'
  • C'validate()'
  • D'getById()'
  • E'delete()'

How the community answered

(28 responses)
  • A
    4% (1)
  • B
    82% (23)
  • C
    11% (3)
  • E
    4% (1)

Explanation

When a product is retrieved from the repository, the developer needs to intercept the returned object and attach the extension attribute data before it reaches the caller. getById() fetches a single product by ID and getList() fetches a collection - these are the two read operations that return product objects, making "after" plugins the perfect hook to populate extension attributes on the result.

Why the distractors are wrong:

  • A. save() - While you may need a "before" plugin on save() to persist extension attribute data, it is not how you load it; the question specifically targets loading/availability.
  • C. validate() - This is not a method defined on ProductRepositoryInterface; it does not exist in the interface contract.
  • E. delete() - This removes a product; it doesn't return a product object that needs extension attributes populated.

Memory tip: Think "After = After you get data back." You create after plugins on the two GET methods - getById() (one product) and getList() (many products) - because that's when you have a product object in hand to attach extra data to. Save and delete are write/destroy operations, not read operations.

Topics

#extension attributes#repository plugin#ProductRepositoryInterface#after plugin

Community Discussion

No community discussion yet for this question.

Full AD0-E724 Practice