ezcommunity / EzMatrixFieldTypeBundle

Bundle that aims to provide ezmatrix field type for eZ Publish Platform 5.x and higher
Other
5 stars 14 forks source link

The fieldType settings get lost when updating a contentType via API #10

Closed gggeek closed 5 years ago

gggeek commented 8 years ago

tested by usage of the MigrationBundle: if a content class has an attribute of type ezmatrix, the names of the columns get reset when the class definition is updated

SalvatorePollaci commented 6 years ago

Any updates on this issue?

SalvatorePollaci commented 6 years ago

It seems the problem is due to the fact that the Converter class has not been set up correctly to accept fieldSettings:

https://github.com/ezcommunity/EzMatrixFieldTypeBundle/blob/master/Persistence/Legacy/Content/FieldValue/Converter/Matrix.php
andrerom commented 6 years ago

Any updates on this issue?

This is a community maintained package, so if you see a way to fix this, feel free to open a PR so we can improve the package.

SalvatorePollaci commented 5 years ago

I've tested https://github.com/ezcommunity/EzMatrixFieldTypeBundle/releases/tag/0.2.1 but I don't think that it has resolved this issue as when I export a content type containing an ezmatrix field type the 'field-settings' attribute is empty even though the field type contains 1 row by default with 14 columns.

bin/console kaliop:migration:generate --type=content_type --match-type=contenttype_identifier --lang=eng-GB --match-value=store AppBundle
-
    type: content_type
    mode: create
    content_type_group: 'Pages'
    identifier: store
    name:
        eng-GB: Store
    description:
        eng-GB: ''
    name_pattern: '<name>'
    url_name_pattern: '<store_name>'
    is_container: false
    lang: eng-GB
    attributes:
        ...
        -
            identifier: opening_hours
            type: ezmatrix
            name:
                eng-GB: 'Opening Hours'
            description:
                eng-GB: ''
            required: true
            searchable: false
            info-collector: false
            disable-translation: true
            category: ''
            position: 17
            field-settings: {  }
            validator-configuration: {  }
andrerom commented 5 years ago

@iherak What do you think?

iherak commented 5 years ago

Hi @andrerom @SalvatorePollaci, I haven't been able to reproduce this. It generated for my example:

field-settings:
                columnList: [{ name: Title, identifier: tag_title, index: '0' }, { name: Subtitle, identifier: tag_subtitle, index: '1' }]

Though, this is on eZ5 project, so maybe there is some difference there? I will try to test this on a newer project as well.

In the meantime, @SalvatorePollaci is there anything else that might help me reproduce the issue?

SalvatorePollaci commented 5 years ago

Hi @iherak @andrerom, I'm currently working on an eZ Platform 2.3 + Legacy Bridge + Netgen Admin UI project.

Here are the package versions I'm using:

ezsystems/ez-matrix-bundle                   dev-master cef5fcb EzMatrix FieldType for eZ Publish Platform
ezsystems/ezpublish-kernel                   v7.2.4
ezsystems/ezpublish-legacy                   v2018.06.1.1
ezsystems/legacy-bridge                      v2.0.10

Screenshot of my content type including the ezmatrix attribute: Schermata 2019-03-29 alle 10 01 23

Output of the following eZ Migrations command:

bin/console kaliop:migration:generate --type=content_type --match-type=contenttype_identifier --lang=eng-GB --match-value=store AppBundle
-
    type: content_type
    mode: create
    content_type_group: 'Pages'
    identifier: store
    name:
        eng-GB: Store
    description:
        eng-GB: ''
    name_pattern: '<name>'
    url_name_pattern: '<store_name>'
    is_container: false
    lang: eng-GB
    attributes:
        ...
        -
            identifier: opening_hours
            type: ezmatrix
            name:
                eng-GB: 'Opening Hours'
            description:
                eng-GB: ''
            required: true
            searchable: false
            info-collector: false
            disable-translation: true
            category: ''
            position: 17
            field-settings: {  }
            validator-configuration: {  }

Do you need any additional info?

Thanks

SalvatorePollaci commented 5 years ago

I've just run an eZ Migration which adds a new field to my 'store' content type then re-run the 'export content type command':

bin/console kaliop:migration:generate --type=content_type --match-type=contenttype_identifier --lang=eng-GB --match-value=store AppBundle

and now the ezmatrix 'field-settings' attribute is populated:

-
    type: content_type
    mode: create
    content_type_group: 'Pages'
    identifier: store
    name:
        eng-GB: Store
    description:
        eng-GB: ''
    name_pattern: '<name>'
    url_name_pattern: '<store_name>'
    is_container: false
    lang: eng-GB
    attributes:
        ...
        -
            identifier: opening_hours
            type: ezmatrix
            name:
                eng-GB: 'Opening Hours'
            description:
                eng-GB: ''
            required: true
            searchable: false
            info-collector: false
            disable-translation: true
            category: ''
            position: 17
            field-settings:
                columnList: [{ name: 'Monday Morning', identifier: monday_morning, index: '0' }, { name: 'Monday Afternoon', identifier: monday_afternoon, index: '1' }, { name: 'Tuesday Morning', identifier: tuesday_morning, index: '2' }, { name: 'Tuesday Afternoon', identifier: tuesday_afternoon, index: '3' }, { name: 'Wednesday Morning', identifier: wednesday_morning, index: '4' }, { name: 'Wednesday Afternoon', identifier: wednesday_afternoon, index: '5' }, { name: 'Thursday Morning', identifier: thursday_morning, index: '6' }, { name: 'Thursday Afternoon', identifier: thursday_afternoon, index: '7' }, { name: 'Friday Morning', identifier: friday_morning, index: '8' }, { name: 'Friday Afternoon', identifier: friday_afternoon, index: '9' }, { name: 'Saturday Morning', identifier: saturday_morning, index: '10' }, { name: 'Saturday Afternoon', identifier: saturday_afternoon, index: '11' }, { name: 'Sunday Morning', identifier: sunday_morning, index: '12' }, { name: 'Sunday Afternoon', identifier: sunday_afternoon, index: '13' }]
            validator-configuration: {  }

I'm not sure why the command is now working. Maybe this is due the fact that the first eZ Migration I ran this time round(to add the new field) populated a certain field in the DB?

Anyway @iherak thanks once again for the fix.