taxonomy text field with multiple values and multilingual migration in drupal7

Created on 27 June 2014, over 10 years ago
Updated 13 March 2023, over 1 year ago

I have a taxonomy with field "field_points_of_interest" and this field have multiple values and multiple languages 'en' and 'zh'

I tried with following methods in migration fields mapping

//..........  
      $this->addFieldMapping('field_points_of_interest', 'points_of_interest');
       $this->addFieldMapping('field_points_of_interest:language', 'points_of_interest_language');
//.............................
// prepareRow function
 public function prepareRow($current_row) {
           $current_row->points_of_interest = array($current_row->points_of_interest_en,$current_row->points_of_interest_zh);
            $current_row->points_of_interest_language = array('en','zh');

}
 

But its not working and showing the sql error to field_points_of_interest data base table.

If we are using only one language with multiple values , its working with out any issues.

eg:
the values in side the $current_row->points_of_interest is like array('a','b','c') and
$current_row->points_of_interest_zh is array('e','f','g')
so after the migration i have to get the values in side the field like

 [field_points_of_interest] => Array
        (
            [en] => Array
                (
                    [0] => Array
                        (
                            [value] => a
                            [format] => full_html
                            [safe_value] => a
                        )

                    [1] => Array
                        (
                            [value] => b
                            [format] => full_html
                            [safe_value] => b
                        )

                    [2] => Array
                        (
                            [value] => c
                            [format] => full_html
                            [safe_value] => c 
                        )                    

                )

            [zh] => Array
                (
                    [0] => Array
                        (
                            [value] => e
                            [format] => full_html
                            [safe_value] => e
                        )

                    [1] => Array
                        (
                            [value] =>  f
                            [format] => full_html
                            [safe_value] =>  f
                        )

                    [2] => Array
                        (
                            [value] =>  g
                            [format] => full_html
                            [safe_value] =>  g
                        )

                )

        )

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India basilbaby6

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024