Skip to content

Conimex import fails when collection is empty  #3291

@michaelborn

Description

@michaelborn

I get a warning "Warning: Undefined array key "order" after running a conimex import:

./bin/console -vvv conimex:import my-site-export-2022-08-08.yaml

I believe this is a new / more strict warning in PHP 8?

https://stackoverflow.com/questions/71025115/dealing-with-php-8-1-warning-for-undefined-array-key

Details

  • Bolt 5.0.6
  • PHP 8.1.8

Reproduction

./bin/console -vvv conimex:import my-site-export-2022-08-08.yaml

Stack trace:

In ContentEditController.php line 439:
                                        
  [ErrorException]                      
  Warning: Undefined array key "order"  
                                        

Exception trace:
  at /home/user/myBoltSite/vendor/bolt/core/src/Controller/Backend/ContentEditController.php:439
 Bolt\Controller\Backend\ContentEditController->updateCollections() at /home/user/myBoltSite/vendor/bobdenotter/conimex/src/Import.php:295
 BobdenOtter\Conimex\Import->importRecord() at /home/user/myBoltSite/vendor/bobdenotter/conimex/src/Import.php:122
 BobdenOtter\Conimex\Import->importContentType() at /home/user/myBoltSite/vendor/bobdenotter/conimex/src/Import.php:91
 BobdenOtter\Conimex\Import->import() at /home/user/myBoltSite/vendor/bobdenotter/conimex/src/Command/ImportCommand.php:62
 BobdenOtter\Conimex\Command\ImportCommand->execute() at /home/user/myBoltSite/vendor/symfony/console/Command/Command.php:299
 Symfony\Component\Console\Command\Command->run() at /home/user/myBoltSite/vendor/symfony/console/Application.php:996
 Symfony\Component\Console\Application->doRunCommand() at /home/user/myBoltSite/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /home/user/myBoltSite/vendor/symfony/console/Application.php:295
 Symfony\Component\Console\Application->doRun() at /home/user/myBoltSite/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/user/myBoltSite/vendor/symfony/console/Application.php:167
 Symfony\Component\Console\Application->run() at /home/user/myBoltSite/bin/console:48

conimex:import <filename>

Steps to reproduce

Evidently, importing a conimex import which does not include the order key.

Expected result

I expected that my content would import.

Actual result

A failed import, with no ability to skip the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions