• Resolved arbab

    (@arbabhassan)


    Hey, I was using humanmade’s CMB which is outdated now and I want to upgrade to CMB2. So the thing is that single fields are working fine after converting the fields code to CMB2, but for the group fields, it’s not working as expected. As in CMB2 group is a repeater field and even after setting this as non-repeatable, It’s still storing fields data in an additional array.
    Let me show you an example.

    Humanmade:

    Array
    (
        [spec_network_technology] => GSM / CDMA / HSPA / EVDO / LTE
        [spec_networks_others] => Array
            (
                [cmb-field-0] => z
                [cmb-field-1] => x
                [cmb-field-2] => c
            )
    
    )

    CMB2:

    Array
    (
        [0] => Array
            (
                [spec_network_technology] => GSM / CDMA / HSPA / EVDO / LTE
                [spec_networks_others] => Array
                    (
                        [0] => z
                        [1] => x
                        [2] => c
                    )
    
            )
    
    )
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not necessarily much we can do from our end in terms of how to mold this in a migrating fashion with regards to the plugin code itself.

    I have a feeling it may be a case of create a new post with your CMB2 configuration and fill in all the applicable fields to see how those are ultimately stored in the meta_value columns, and note down what type of changes need to be made for the existing migrating data and process them to match.

    For example with your example above, assuming that the 2nd one is how it’s going to be stored with the intended configuration, it’d be a case of getting the saved value, pushing that into a new indexed array and then updating. It’d be a batch process in the end to work through all of them which may or may not be a large job, I don’t know how much content you’re working with.

    I hope that makes sense ??

    Thread Starter arbab

    (@arbabhassan)

    That’s clear, thank you.

    However, my guess is that CMB2 should not store group field data in an indexed array when setting the repeatable => false.

    • This reply was modified 3 years, 8 months ago by arbab.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Understandable sentiment there, but I’m also curious if this was a design decision in the event that users wanted to move a field type to repeatable in the future, with minimal changes needed.

    Thread Starter arbab

    (@arbabhassan)

    Well, that makes sense. So, if the user wants to make the group field repeatable in the future, then it’s perfectly fine.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Migration Issue’ is closed to new replies.