Skip to Content

Adobe AD0-E718: Which steps should Architect take to change type of “my_attribute” from text to int

Question

A company has an Adobe Commerce store. An attribute named “my_attribute” (type “text”) is created to save each product’s global ID that is shared between multiple systems. Several months after going live, the values of “my_attribute” are all integer. This causes a problem for the other systems when those systems receive this data. An Adobe Commerce Architect needs to recommend a solution to change the type of “my_attribute” from text to int. Which two steps should the Architect take to achieve this? (Choose two.)

A. Migrate data from table “catalog_product_entity_text” to “catalog_product_entity_int” for the attribute_id
B. Go to Admin > Stores > Attributes > Product, edit “my_attribute” and update type from “text” to “int”
C. Write a plugin for \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend::afterLoad() and load data from “catalog_product_entity_int”
D. Create a Data Patch and update “my_attribute” type from “text” to “int”
E. Run the command bin/magento indexer:reset catalog_product_attribute

Answer

B. Go to Admin > Stores > Attributes > Product, edit “my_attribute” and update type from “text” to “int”
D. Create a Data Patch and update “my_attribute” type from “text” to “int”

Explanation

To change the type of the “my_attribute” attribute from text to int in Adobe Commerce, the Adobe Commerce Architect should take the following two steps:

B. Go to Admin > Stores > Attributes > Product, edit “my_attribute,” and update the type from “text” to “int”:
This step involves accessing the Adobe Commerce Admin panel and navigating to Stores > Attributes > Product. Locate the “my_attribute” attribute and edit its settings. Change the attribute type from “text” to “int” to ensure that the attribute values are treated as integers.

D. Create a Data Patch and update “my_attribute” type from “text” to “int”:
A Data Patch is a recommended approach to make changes to the database schema and data in Adobe Commerce. The architect should create a Data Patch that updates the attribute “my_attribute” to have the type “int” instead of “text.” This Data Patch can be created as a code module and applied using the command bin/magento setup:upgrade.

By performing these two steps, the attribute “my_attribute” will be changed from text to int, ensuring that the values stored in this attribute are treated as integers rather than text. This resolves the problem of other systems receiving incorrect data due to the attribute values being integers but stored as text.

The other options are not the correct steps to achieve the desired outcome:

A. Migrate data from the “catalog_product_entity_text” table to the “catalog_product_entity_int” table for the attribute_id:
This option suggests migrating data from one table to another, which is not necessary or recommended for changing the attribute type. Migrating data between tables is typically done for different purposes and not for modifying the attribute type.

C. Write a plugin for \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend::afterLoad() and load data from “catalog_product_entity_int”:
Writing a plugin for loading data from a different table using the “afterLoad()” method is not necessary in this case. Changing the attribute type does not require customizing the data loading process.

E. Run the command bin/magento indexer:reset catalog_product_attribute:
Running the indexer reset command is not relevant to changing the attribute type. The indexers are responsible for improving the performance of data queries and search functionality in Adobe Commerce, and resetting them is not required for this specific attribute type change.

In summary, the recommended steps for an Adobe Commerce Architect to change the attribute type from text to int for the “my_attribute” attribute are:
B. Go to Admin > Stores > Attributes > Product, edit “my_attribute,” and update the type from “text” to “int.”
D. Create a Data Patch and update “my_attribute” type from “text” to “int.”

Reference

Adobe Commerce Architect Master AD0-E718 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Adobe Commerce Architect Master AD0-E718 exam and earn Adobe Commerce Architect Master AD0-E718 certification.