kaliop-uk / ezmigrationbundle

This bundle makes it easy to handle eZPlatform / eZPublish5 content upgrades/migrations
GNU General Public License v2.0
53 stars 81 forks source link

Add support for ezmatrix field: defining columns in Content Type Migration and filling columns in Content Migration #217

Closed maczuk closed 3 years ago

maczuk commented 5 years ago

Add support for defining columns for example:

Content Type Migration:

-
    type: content_type
    mode: create
    content_type_group: 1
    name: Article
    identifier: article
    name_pattern: <title>
    is_container: false
    attributes:
        -
            type: ezstring
            name: Title
            identifier: title
            required: true
            searchable: true
        -
            type: ezmatrix
            name: Bibliography
            identifier: bibliography
            columns:
                - { name: Autors, identifier: authors }
                - { name: Title, identifier: title }
                - { name: Release information, identifier: release_info }

Content Item Migration:

-
    type: content
    mode: create
    content_type: reference:content_type_journal_article
    parent_location: reference:journal_issue_52019_loc
    owner: admin
    attributes:
        title: Sample
        bibliography:
            -
                authors: 'Author A, Author B'
                title: 'Lorem ipsum'
                release_info: 'Cracov 2012'
            -
                authors: 'Author 1, Author 2'
                title: 'Lorem ipsum dolor sit amet'
                release_info: 'R info abc'
            -
                authors: 'Athor I, Author II'
                title: 'This is a title'
                release_info: 'Warsaw 2000'

Thanks!

gggeek commented 3 years ago

This is definitely not helped by the fact that there are 2 separate implementations of the 'ezmatrix' field type:

gggeek commented 3 years ago

Implemented. Will be in 5.14

homarx commented 3 years ago

@gggeek How do I have to define the columns?

I tried it the way @maczuk described it in the beginning of this issue but it didn't work. The ezmatrix fieldtype is created, but the columns definition is not taken into account.

Do you have a working example?

Thanks in advance :-)

gggeek commented 3 years ago

@homarx is it correct that you want to define an ezmatrix fieldtype with column defs, without (or before) creating any such content? Also: which version of the matrix bundle (and eZ) are you using?

homarx commented 3 years ago

@gggeek Thanks for your fast reply! Correct, I tried to create a new content type with an ezmatrix field.

The versions are: ezsystems/ezpublish-kernel v7.5.13 kaliop/ezmigrationbundle 5.15.0

And this is the field definition in migration file:

 -
      type: ezmatrix
      name: Answer
      identifier: answer
      columns:
        - { "name": "Answer", "identifier": "answer"}
      required: false
      searchable: true
      info-collector: false
      disable-translation: false
      category: default
      position: 5
homarx commented 3 years ago

@gggeek I just realized that there is a typo in your docs: ezmigrationbundle/Resources/doc/DSL/ContentTypes.yml (line 37)

This is the description of the ezmatrix config not the ezmedia one.

As I am using the community version of ezplatform, columns and minimum_rows are not wrking for me ...

gggeek commented 3 years ago

Thanks for the notice, I have fixed the docs. I guess that this ticket can stay 'closed' then ;-)

homarx commented 3 years ago

Can you confirm, that the configuration for columns and minimum_rows is not working for the community version?

gggeek commented 3 years ago

Yes - it is sadly a problem of the legacy matrix fieldtype storing its definition in a way that makes it incompatible with the eZ5 api.

homarx commented 3 years ago

But I am using ezp 2.5 ?!? Shouldn't it work with it?