Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Undefined offset: 19 in vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 452 #886

Open
ioweb-gr opened this issue Jan 4, 2022 · 2 comments

Comments

@ioweb-gr
Copy link

ioweb-gr commented Jan 4, 2022

Preconditions

  1. M1.9.4.5
  2. M2.4.3-p1

Steps to reproduce

You need a Magento installation with additional entries in eav_entity_type and attributes in eav_attribute linked to a deleted eav_entity_type

In my case in the table eav_entity_type on M1 I have this dataset


+--------------+--------------------+------------------------------+------------------------------+-----------------------+------------------+---------------+---------------+----------------+------------------------+----------------------------+-------------------+--------------------+------------------+--------------------------+----------------------------------------+
|entity_type_id|entity_type_code    |entity_model                  |attribute_model               |entity_table           |value_table_prefix|entity_id_field|is_data_sharing|data_sharing_key|default_attribute_set_id|increment_model             |increment_per_store|increment_pad_length|increment_pad_char|additional_attribute_table|entity_attribute_collection             |
+--------------+--------------------+------------------------------+------------------------------+-----------------------+------------------+---------------+---------------+----------------+------------------------+----------------------------+-------------------+--------------------+------------------+--------------------------+----------------------------------------+
|1             |customer            |customer/customer             |customer/attribute            |customer/entity        |NULL              |NULL           |1              |default         |1                       |eav/entity_increment_numeric|0                  |8                   |0                 |customer/eav_attribute    |customer/attribute_collection           |
|2             |customer_address    |customer/address              |customer/attribute            |customer/address_entity|                  |               |1              |default         |2                       |                            |0                  |8                   |0                 |customer/eav_attribute    |customer/address_attribute_collection   |
|3             |customer_payment    |                              |                              |customer/entity        |                  |               |1              |default         |3                       |                            |0                  |8                   |0                 |                          |                                        |
|4             |order               |sales/order                   |                              |sales/order            |                  |               |1              |default         |18                      |eav/entity_increment_numeric|1                  |8                   |0                 |                          |                                        |
|5             |order_status        |                              |                              |sales/order            |                  |               |1              |default         |0                       |                            |0                  |8                   |0                 |                          |                                        |
|6             |order_address       |sales/order_address           |                              |sales/order_entity     |                  |               |1              |default         |20                      |                            |0                  |8                   |0                 |                          |                                        |
|7             |order_item          |sales/order_item              |                              |sales/order_entity     |                  |               |1              |default         |21                      |                            |0                  |8                   |0                 |                          |                                        |
|8             |order_payment       |sales/order_payment           |                              |sales/order_entity     |                  |               |1              |default         |22                      |                            |0                  |8                   |0                 |                          |                                        |
|9             |catalog_category    |catalog/category              |catalog/resource_eav_attribute|catalog/category       |                  |               |0              |default         |12                      |                            |0                  |8                   |0                 |catalog/eav_attribute     |catalog/category_attribute_collection   |
|10            |catalog_product     |catalog/product               |catalog/resource_eav_attribute|catalog/product        |NULL              |NULL           |0              |default         |9                       |NULL                        |0                  |8                   |0                 |catalog/eav_attribute     |catalog/product_attribute_collection    |
|11            |quote               |sales/quote                   |                              |sales/quote            |                  |               |1              |default         |23                      |                            |0                  |8                   |0                 |                          |                                        |
|12            |quote_address       |sales/quote_address           |                              |sales/quote_address    |                  |               |1              |default         |24                      |                            |0                  |8                   |0                 |                          |                                        |
|13            |quote_address_rate  |sales/quote_address_rate      |                              |sales/quote_entity     |                  |               |1              |default         |25                      |                            |0                  |8                   |0                 |                          |                                        |
|14            |quote_address_item  |sales/quote_address_item      |                              |sales/quote_entity     |                  |               |1              |default         |26                      |                            |0                  |8                   |0                 |                          |                                        |
|15            |quote_item          |sales/quote_item              |                              |sales/quote_item       |                  |               |1              |default         |27                      |                            |0                  |8                   |0                 |                          |                                        |
|16            |quote_payment       |sales/quote_payment           |                              |sales/quote_entity     |                  |               |1              |default         |28                      |                            |0                  |8                   |0                 |                          |                                        |
|17            |order_status_history|sales/order_status_history    |                              |sales/order_entity     |                  |               |1              |default         |29                      |                            |0                  |8                   |0                 |                          |                                        |
|18            |invoice             |sales/order_invoice           |                              |sales/order_entity     |                  |               |1              |default         |30                      |eav/entity_increment_numeric|1                  |8                   |0                 |                          |                                        |
|20            |invoice_item        |sales/order_invoice_item      |                              |sales/order_entity     |                  |               |1              |default         |32                      |                            |0                  |8                   |0                 |                          |                                        |
|22            |invoice_shipment    |                              |                              |sales/invoice          |                  |               |1              |default         |34                      |                            |0                  |8                   |0                 |                          |                                        |
|23            |invoice_comment     |sales/order_invoice_comment   |                              |sales/order_entity     |                  |               |1              |default         |50                      |                            |0                  |8                   |0                 |                          |                                        |
|24            |shipment            |sales/order_shipment          |                              |sales/order_entity     |                  |               |1              |default         |51                      |eav/entity_increment_numeric|1                  |8                   |0                 |                          |                                        |
|25            |shipment_item       |sales/order_shipment_item     |                              |sales/order_entity     |                  |               |1              |default         |52                      |                            |0                  |8                   |0                 |                          |                                        |
|26            |shipment_comment    |sales/order_shipment_comment  |                              |sales/order_entity     |                  |               |1              |default         |53                      |                            |0                  |8                   |0                 |                          |                                        |
|27            |shipment_track      |sales/order_shipment_track    |                              |sales/order_entity     |                  |               |1              |default         |54                      |                            |0                  |8                   |0                 |                          |                                        |
|28            |creditmemo          |sales/order_creditmemo        |                              |sales/order_entity     |                  |               |1              |default         |55                      |eav/entity_increment_numeric|1                  |8                   |0                 |                          |                                        |
|29            |creditmemo_item     |sales/order_creditmemo_item   |                              |sales/order_entity     |                  |               |1              |default         |56                      |                            |0                  |8                   |0                 |                          |                                        |
|30            |creditmemo_comment  |sales/order_creditmemo_comment|                              |sales/order_entity     |                  |               |1              |default         |57                      |                            |0                  |8                   |0                 |                          |                                        |
|31            |m_filter            |mana_filters/filter           |                              |mana_filters/filter    |                  |               |1              |default         |58                      |                            |0                  |8                   |0                 |mana_core/attribute       |mana_filters/filter_attribute_collection|
+--------------+--------------------+------------------------------+------------------------------+-----------------------+------------------+---------------+---------------+----------------+------------------------+----------------------------+-------------------+--------------------+------------------+--------------------------+----------------------------------------+

Notice the missing entity_type_id = 19 on this table.

However on eav_attribute table I have these attributes existing on the missing entity_type_id

+------------+--------------+-------------------+---------------+--------------------------------------------+------------+-------------+--------------+--------------+--------------+--------------+------------+-----------+---------------+-------------+---------+----+
|attribute_id|entity_type_id|attribute_code     |attribute_model|backend_model                               |backend_type|backend_table|frontend_model|frontend_input|frontend_label|frontend_class|source_model|is_required|is_user_defined|default_value|is_unique|note|
+------------+--------------+-------------------+---------------+--------------------------------------------+------------+-------------+--------------+--------------+--------------+--------------+------------+-----------+---------------+-------------+---------+----+
|434         |19            |address_type       |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|442         |19            |city               |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|440         |19            |company            |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|446         |19            |country_id         |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|436         |19            |customer_address_id|NULL           |                                            |int         |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|435         |19            |customer_id        |NULL           |                                            |int         |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|437         |19            |email              |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|448         |19            |fax                |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|438         |19            |firstname          |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|439         |19            |lastname           |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|433         |19            |order_address_id   |NULL           |                                            |int         |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|432         |19            |parent_id          |NULL           |sales_entity/invoice_attribute_backend_child|static      |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|445         |19            |postcode           |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|443         |19            |region             |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|444         |19            |region_id          |NULL           |                                            |int         |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|441         |19            |street             |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
|447         |19            |telephone          |NULL           |                                            |varchar     |             |              |text          |              |NULL          |            |1          |0              |             |0        |    |
+------------+--------------+-------------------+---------------+--------------------------------------------+------------+-------------+--------------+--------------+--------------+--------------+------------+-----------+---------------+-------------+---------+----+

In this part

$this->mapEntityTypeIdsDestOldNew has in my case a map of entity_ids without 19 in it. So it will try to migrate the attribute to a non-existing entity_id

{
  "1": "1",
  "2": "2",
  "3": "3",
  "4": "4",
  "5": "5",
  "6": "6",
  "7": "7",
  "8": "8",
  "9": "9",
  "10": "10",
  "11": "11",
  "12": "12",
  "13": "13",
  "14": "14",
  "15": "15",
  "16": "16",
  "17": "17",
  "18": "18",
  "20": "20",
  "22": "22",
  "23": "23",
  "24": "24",
  "25": "25",
  "26": "26",
  "27": "27",
  "28": "28",
  "29": "29",
  "30": "30",
  "31": "31"
}

Basically the data migration tool is trying to migrate attributes linked to an entity_type_id that was deleted. M1 wasn't cleaning the attributes up when the entity_type was removed. So it ends up in that state and throws an error

Notice: Undefined offset: 19 in vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 452

Expected result

Migration proceeds

Actual result

Notice: Undefined offset: 19 in vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 452

Additional notes

@m2-assistant
Copy link

m2-assistant bot commented Jan 4, 2022

Hi @ioweb-gr. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


@tweetyx
Copy link

tweetyx commented Mar 11, 2024

so in eav_entity_type there are no 19 entity id (maybe cause by a old custom plugin)
so in eav_attribute you need to remove attribute with entity 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants