ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 32 - AD0-E716 discussion

Report
Export

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?

A.
Add an Uninstall.php file extending \l1agento\Framework\Setup\UninstallInterface tO the module's Setup directory and implement the uninstall method.
Answers
A.
Add an Uninstall.php file extending \l1agento\Framework\Setup\UninstallInterface tO the module's Setup directory and implement the uninstall method.
B.
Add instructions to the module's README.md file instructing merchants and developers that they must manually remove this attribute if they want to uninstall the module.
Answers
B.
Add instructions to the module's README.md file instructing merchants and developers that they must manually remove this attribute if they want to uninstall the module.
C.
Make the Data Patch implement \Magento\Framework\setup\Patch\PatchRevertabieinterface and implement the revert method to remove the product attribute.
Answers
C.
Make the Data Patch implement \Magento\Framework\setup\Patch\PatchRevertabieinterface and implement the revert method to remove the product attribute.
Suggested answer: C

Explanation:

According to the Develop data and schema patches guide for Magento 2 developers, data patches can also implement PatchRevertabieinterface to provide rollback functionality for their changes. The 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

Reference: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/data-patches.html

asked 02/10/2024
EDUARDO VIDAL
41 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first