How should a record be removed from a database which is using a model that was inherited from the \Magento\Framework\Model\AbstractModel class?
Answer(s): C
The "delete" method on the \Magento\Framework\Model\AbstractModel class is used to remove a record from the database. This method will also cascade the delete to any related records.
In a new release of a module, a developer decides to rename a table that was defined in the earlier versions.Which action, if any, allows the developer to prevent data loss?
Answer(s): A
To prevent data loss when renaming a table that was defined in the earlier versions of a module, the developer should define onCreate="migrateDataFromAnotherTable(old_table_name)" attribute in the table tag of the db_schema.xml file. This attribute will instruct Adobe Commerce to copy all data from the old table to the new table during installation or upgrade.Declarative schema does not support RENAME TABLE statement, so the data will not be migrated to the new table automatically. The db.schema_whitelist.json file is used to whitelist changes that are allowed for backward compatibility, not for data migration.
Adobe Commerce Developer Guide - Declare schema and data patches
A developer defined a new table in db.schema.xml while creating a new module.What should be done to allow the removal of columns from the database when deleting them from db.schema.xml?
If a developer wants to allow the removal of columns from the database when deleting them from db.schema.xml, they need to define the removable columns in the db_schema_whitelist.json file. This file will tell Magento which columns can be removed from the database.
Which attribute option restricts Catalog EAV attributes to only certain product types?
The allowed_in attribute restricts Catalog EAV attributes to only certain product types. This attribute can be used to prevent certain attributes from being displayed on certain product types.
Which two methods add sorting to collections inherited from the \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection class? (Choose two.)
Answer(s): A,D
The two methods that add sorting to collections inherited from the\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection class are setOrder and addOrder. These methods allow adding one or more order clauses to a collection query.The setSorting and addSorting methods do not exist in Adobe Commerce.
[Adobe Commerce Developer Guide - Collections]
Post your Comments and Discuss Adobe AD0-E717 exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the AD0-E717 content, but please register or login to continue.