nerdexam
Adobe

AD0-E716 · Question #32

An Adobe Commerce developer has created a module that adds a product attribute to all product types via a Data Patch-According to best practices, how would the developer ensure this product…

The correct answer is C. Make the Data Patch implement \Magento\Framework\setup\Patch\PatchRevertabieinterface. According to the Develop data and schema patches guide for Magento 2 developers, data patches revert() method contains the instructions to undo the data modifications made by the patch. To ensure that the product attribute is removed when the module is uninstalled, the…

Database

Question

An Adobe Commerce developer has created a module that adds a product attribute to all product types via a Data Patch-According to best practices, how would the developer ensure this product attribute is removed in the event that the module is uninstalled at a later date?

Options

  • AAdd an Uninstall.php file extending \l1agento\Framework\Setup\UninstallInterface tO the
  • BAdd instructions to the module's README.md file instructing merchants and developers that they
  • CMake the Data Patch implement \Magento\Framework\setup\Patch\PatchRevertabieinterface

How the community answered

(44 responses)
  • A
    7% (3)
  • B
    11% (5)
  • C
    82% (36)

Explanation

According to the Develop data and schema patches guide for Magento 2 developers, data patches revert() method contains the instructions to undo the data modifications made by the patch. To ensure that the product attribute is removed when the module is uninstalled, the developer should make the data patch implement PatchRevertabieinterface and implement the revert method to remove the product attribute using EavSetupFactory or AttributeRepositoryInterface. Verified schema/data-patches.html

Topics

#data patches#PatchRevertableInterface#product attributes#module uninstall

Community Discussion

No community discussion yet for this question.

Full AD0-E716 Practice