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 any idea Please help us
If we are using only one language with multiple values , its working with out any issues.
Any one doing the migration with multiple values with multiple languages in a taxonomy field?
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
)
)
)
Comments
Comment #1
basilbaby6 CreditAttribution: basilbaby6 commentedComment #2
basilbaby6 CreditAttribution: basilbaby6 commentedComment #3
basilbaby6 CreditAttribution: basilbaby6 commentedComment #4
basilbaby6 CreditAttribution: basilbaby6 commentedComment #5
basilbaby6 CreditAttribution: basilbaby6 commentedComment #6
Alienpruts CreditAttribution: Alienpruts commentedActually, I'm having the same problem, but with translated (entity translation) multiple-value fields.
My problem is more about handling the translation part of the migration. I can add a mapping like this :
just fine (if I construct an array with all values in prepareRow() function. But I am stumped as to how to handle the translation part.
I thought If I constructed an array with array's in it like this :
and a mapping
(where languages if ofcourse an array with the defined languages)
that would do the trick, but no cigar.
Does anyone have any light to shed on this situation?
EDIT : This is the output in the messages table, for the curious. I understand the message (it's because I'm passing an array containing arrays), but I have no clue how to remedie this
mb_substr() expects parameter 1 to be string, array given File /workspace/easym_kul/includes/unicode.inc, line 589
Comment #7
cthos CreditAttribution: cthos commentedUpdating some fields. Dropping the priority to Normal, and changing the component to Code.
Multiple languages in destination fields is not something Migrate handles very well currently. What you're probably going to have to do for the time being is making use of
prepare
in order to get the field into the right shape during the migration for these fields.Comment #8
mikeryanTo expand on the previous comment, given the original example use case here:
In your migration you would implement a prepare function like:
Comment #9
basilbaby6 CreditAttribution: basilbaby6 commentedHi Mikeryan,
Thanks a lot for your suggestion :) . This is working in the text fields with multiple values. Last time I tried with "prepare" function, but I declared the "value" array seems to be little different, because of that it was failing.
Regards,
Basil
Comment #10
basilbaby6 CreditAttribution: basilbaby6 commentedMikeryan ,
I have identified a few more issues in migrations
1. Image fields with multilingual migration.
2. File field with multiple value migration.
3. File field with multilingual migration.
I will try with "file_save_data" and "prepare" functions and let you know if this is a success or failed.
Comment #11
basilbaby6 CreditAttribution: basilbaby6 commentedHere is the way we can map the file fields and image fields.
This will support multiple file fields migration and multilingual file field migration.
Make sure that "field_port_guide" removed from field mapping.
Comment #12
apaderno