bobdenotter / conimex

🍛 Content Importer and Exporter (as YAML) for Bolt 4
MIT License
6 stars 14 forks source link

Importing a collection with one field results in an error #51

Open Steve-MP opened 2 years ago

Steve-MP commented 2 years ago

When I try to import a repeater field with one sub-field from Bolt 3.7 into a collection field in a Bolt 5 database using conimex, I get the following error:

In FieldRepository.php line 96:

  [TypeError]                                                                                                                                                        
  Argument 1 passed to Bolt\Repository\FieldRepository::factory() must be an instance of Tightenco\Collect\Support\Collection, null given, called in vendor/bolt/core/src/Controller/Backend/ContentEditController.php on line 453   

Looking at the controller where the error is thrown, I see that $collection->getDefinition()->get('fields')->get($name); is returning an empty result, perhaps because the name being passed to it is 'timetabl' not 'timetable' (which is the name of the field). I can see that the repeater name is always being truncated by one letter (so if I shorted the field name to 'time' in the contenttypes.yaml' file, it becomes 'tim' in the import script), but I have not idea whether this is intentional or not.

arkhi commented 1 year ago

Is it a duplicate of #27?

Senne commented 11 months ago

FYI, I found out it is by design that it omits the last character:

https://github.com/bobdenotter/conimex/blob/0eb963dbc771e970168f7c8e5add62e1651bf01f/src/Import.php#L229-L231