QuestionQ4

Store Operations and Admin

An Adobe Commerce Architect must log the result of a ServiceClass::getData method execution after every plugin has run. The method is public, and several plugins are declared for it. These plugins include after and around types, and each has a specified sortOrder.

Which solution should be used to satisfy this requirement?

  • A Declare a new plugin with the sortOrder value higher than the highest declared plugin sortOrder and implement afterGetData method.
  • B Declare a new plugin with the sortOrder value lower than the lowest declared plugin sortOrder and implement aroundGetData method.
  • C Declare a new plugin with the sortOrder value higher than the highest declared plugin sortOrder and implement aroundGetData method.
Explanation

An around plugin with the lowest sortOrder wraps every higher-priority-numbered plugin execution. Logging after its $proceed() call returns occurs only after the observed method and all subsequent plugins—including their after methods and the post-proceed portions of their around methods—have completed. Adobe Commerce documents that around plugins affect the execution flow of all plugins that follow them and that plugin priority is determined by sortOrder.

Learn more

Community Discussion

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