magento / magento/data-migration-tool
Undefined Offset: in Migration/Step/Eav/Data.php
- Dominant language
- PHP
- Stars
- 339
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
### Before I continue here:
For reference, I created this topic around the same time I added this issue last year:
[Why is the newer 2.3.5 Step/Eav/Data.php so much smaller #812](https://github.com/magento/data-migration-tool/issues/812)
## Edit 2021:
Please read the link above for the concern I raised:
Summary: Looking at the current commits (2021) for `Step/Eav/Data.php` it still has less code (alot old code removed.... and **hard-coded quantity** `$this->progress->start(7);` vs OLDER commits: `$this->progress->start($this->getIterationsCount());` ) as previous commits I mentioned in that topic; I wondered then, and still do: is this not the reason why `Step/Eav/Data.php` processing is giving us so much issues? Why were so much attribute processing removed, why are the dynamic `getIterationsCount()` not used anymore?
### Original topic:
### Preconditions
1. Magento 1.7.0.2 database
2. Magento 2.3.5 database, PHP 7.3
### Steps to reproduce
1. Setup and install a clean new version of Magento 2.3.5
2. Install Migration Data tool v 2.3.5 `composer require magento/data-migration-tool:2.3.5`
3. Run `setup:upgrade`
4.1 Make sure that _var/migration*_ is deleted so that you have a new migration from start. (in particular the file **migration-tool-progress.lock**). I would have assumed `--reset` does the same, but seems not.
4. Run `bin/magento migrate:data path/to/config.xml` that has configuration info from your source Magento 1 database and Magento 2 destination.
### Expected result
1. A proper clean migration with no exceptions/errors/halts.
### Actual result
**Halts immediately on the following error**
1.
> Notice: Undefined offset: 4 in /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 492
2. Inside src/Migration/Step/Eav/Data.php on line 492: _It seems that it is attempting to update the record **attribute_group_id** with the populated entry inside **mapAttributeGroupIdsSourceDest[id]**_, but it is not available inside my data...
`$record['attribute_group_id'] = $this->mapAttributeGroupIdsSourceDest[$record['attribute_group_id']];`
**attribute_group_id for $record is 4, but there seems to be a missing mapAttributeGroupIdsSourceDest[4] corresponding map source/destination**
**In fact there seems to be more missing indexes when I debugged**
3. [Screenshot, logs]
> [**2020-05-11 07:11:45] main.ERROR: Notice: Undefined offset: 4 in /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 492
> #0 /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php(494): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined offse...', '/var/www/html/m...', 492, Array)**
> #1 /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php(183): Migration\Step\Eav\Data->migrateCustomEntityAttributes()
> #2 /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Mode/AbstractMode.php(82): Migration\Step\Eav\Data->perform()
> #3 /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Mode/Data.php(124): Migration\Mode\AbstractMode->runStage(Object(Migration\Step\Eav\Data), 'EAV Step', 'data migration')
> #4 /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Mode/Data.php(69): Migration\Mode\Data->runData(Array, 'EAV Step')
> #5 /var/www/html/mag_new/vendor/magento/data-migration-tool/src/Migration/Console/MigrateDataCommand.php(59): Migration\Mode\Data->run()
> #6 /var/www/html/mag_new/vendor/symfony/console/Command/Command.php(255): Migration\Console\MigrateDataCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #7 /var/www/html/mag_new/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #8 /var/www/html/mag_new/vendor/magento/framework/Interception/Interceptor.php(138): Migration\Console\MigrateDataCommand\Interceptor->___callParent('run', Array)
> #9 /var/www/html/mag_new/vendor/magento/framework/Interception/Interceptor.php(153): Migration\Console\MigrateDataCommand\Interceptor->Magento\Framework\Interception\{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #10 /var/www/html/mag_new/generated/code/Migration/Console/MigrateDataCommand/Interceptor.php(104): Migration\Console\MigrateDataCommand\Interceptor->___callPlugins('run', Array, Array)
> #11 /var/www/html/mag_new/vendor/symfony/console/Application.php(1001): Migration\Console\MigrateDataCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /var/www/html/mag_new/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Migration\Console\MigrateDataCommand\Interceptor), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #13 /var/www/html/mag_new/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #14 /var/www/html/mag_new/vendor/symfony/console/Application.php(147): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #15 /var/www/html/mag_new/bin/magento(23): Symfony\Component\Console\Application->run()
> #16 {main} [] []
### Additional notes
- ** This is a clean installation of v2.3.5 Magento as described above, with no pending `migration-tool-progress.lock` inside var/
- My possible related query **[ - regarding a much smaller Eav/Data.php file]**(https://github.com/magento/data-migration-tool/issues/812)
### Questions
- Is the map code from the last few commits that should append array `mapAttributeGroupIdsSourceDest` with entries not missing some processing that used to be there? (See my related query above) (I have done previous migrations pre v.2.3 successfully using the **same source Magento 1 database)**
- Is my issue that I need to map groups as well? Where do I do this?
Contributor guide
Research direction
Start with src/Migration/Step/Eav/Data.php, especially migrateCustomEntityAttributes() around line 492, and reproduce with bin/magento migrate:data using the referenced Magento 1 and 2 databases and config.xml. Compare how mapAttributeGroupIdsSourceDest is populated, including the concerns in issue #812. Done means the EAV migration completes without the undefined-offset error and handles the missing attribute-group mapping correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100