bobdenotter / conimex

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

Error during import of data structure with collection type #27

Open eherber opened 3 years ago

eherber commented 3 years ago

Running an import of a data structure containing a collection results in the following error message:

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

The export has been created with app/nut database:export. The import is done by conimex version 1.3.5. However the same error occurs with conimex version 2.0.

Enclosed you will find the contenttypes.yaml defintion file for the custom datatype "eingangsseite" and the conimex.support.tar.gz eingangsseite.export.yaml file.

Thank you in advance.

-Eric

michaelborn commented 2 years ago

I get the same error reported above.

Here's the snippet of a page contenttype showing the gallery repeater (now collection).

gallery:
            - { image: { file: 2019-02/screen-shot-2019-02-09-at-10.28.15-pm.png, title: '' }, html: '' }
            - { image: { file: 2019-02/1549769601_screen-shot-2019-02-09-at-10.25.51-pm.png, title: '' }, html: '' }

Here's my Bolt 5 contenttypes.yaml definition for the gallery field on a page contenttype:

gallery:
            type: collection
            limit: 10
            prefix: "<p>Upload multiple images to create a photo gallery</p>"
            fields:
                slide:
                    type: set
                    fields:
                        image:
                            type: image
                            extensions: [ gif, jpg, png ]
                            attrib: title
                        html:
                            type: html
                            height: 150px

Are we simply missing the set definition?

bobdenotter commented 2 years ago

Bolt 3 had no concept of set, so that might be the case. This seems like a valid bug, yes!

michaelborn commented 2 years ago

So, I generated an export after playing with the new Collection on a page within Bolt 5.

Here's what that data exports as:

gallery: [{ name: slide, type: set, value: { image: { filename: 2017-09/rsz-dscn0057-01-1-.jpg, path: /files/2017-09/rsz-dscn0057-01-1-.jpg, media: '', thumbnail: /thumbs/400Ă—400/2017-09/rsz-dscn0057-01-1-.jpg, fieldname: image, alt: 'test this gallery thing.', url: 'http://127.0.0.1:8080/files/2017-09/rsz-dscn0057-01-1-.jpg', extension: jpg }, html: '<p>we''re done here, ok?<br></p>' } }]

So I think conimex needs to read in the - image: {}-formatted export from Bolt 3 as an array, and "assume" the set definition based on the contenttype definition.

eherber commented 2 years ago

Unfortunately this is still a show stopper for us. We are unable do migrate from bolt v3 to v5 on three websites. bolt v3 runs out of support by the end of the year (:-

twwd commented 1 year ago

Is there a workaround for this issue? Or a fix?

Senne commented 9 months ago

I can’t import Bolt 3.7 data because of this issue either. Will try to debug the Conimex plugin and updateCollections() in ContentEditController a bit myself, so I can help where possible, but it’d be good if someone with more knowledge of the plugin and the Bolt internals in general has a look too.