ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 27 - AD0-E716 discussion

Report
Export

An Adobe Commerce developer is creating a module (Vendor.ModuleName) to be sold on the Marketplace. The new module creates a database table using declarative schema and now the developer needs to make sure the table is removed when the module is disabled.

What must the developer do to accomplish this?

A.
There is nothing further the developer needs to do. The table will be removed when the module is disabled and bin/magento setup:upgrade is run.
Answers
A.
There is nothing further the developer needs to do. The table will be removed when the module is disabled and bin/magento setup:upgrade is run.
B.
There is nothing further the developer needs to do. The table will be removed when the when bin/magento module:uninstall vendor_ModuleName is run.
Answers
B.
There is nothing further the developer needs to do. The table will be removed when the when bin/magento module:uninstall vendor_ModuleName is run.
C.
Add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function.
Answers
C.
Add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function.
Suggested answer: C

Explanation:

According to the Declarative Schema Overview guide for Magento 2 developers, declarative schema is a new feature that allows developers to declare the final desired state of the database and has the system adjust to it automatically, without performing redundant operations. However, declarative schema does not support uninstalling modules or reverting changes. To remove a table when a module is disabled, the developer needs to add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function. The revert function will be executed when the module is disabled using bin/magento module:disable command. Verified

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

asked 02/10/2024
Wilker Aguiar
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first