Import will not work on custom entities with no required field

Created on 24 April 2024, 8 months ago
Updated 17 June 2024, 6 months ago

Great module.

Due to the way the required array is made in the getEntityTypeFields logic, it only gets set when it finds a required field. And without the array the import crashes out with an unrecoverable error. I suggest moving where that array is initially set. For our needs we simply made one of the core fields of our custom entity required.

This is to help anyone else searching as we could not find anything matching our error prior to going through the code itself.

The full error was:

TypeError: Drupal\csv_importer\Form\ImporterForm::getEntityTypeMissingFields(): Argument #2 ($required) must be of type array, null given, called in ***/site/modules/contrib/csv_importer/src/Form/ImporterForm.php on line 353 in Drupal\csv_importer\Form\ImporterForm->getEntityTypeMissingFields() (line 317 of ***/site/modules/contrib/csv_importer/src/Form/ImporterForm.php).

Many thanks

🐛 Bug report
Status

Needs review

Version

1.16

Component

Code

Created by

🇬🇧United Kingdom vince.rowe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024