Issue with drupal 7 migrate (and migrate extras) module. Address fields not migrating -


i have issue drupal 7 data migration whereby using migrate module migrate extras , address field. entire migration working fine except address field data.

there seem plenty old examples around, none use subfield notation migrate supports. must missing obvious. many in advance!

here's code:

class docinfomigration extends joomlamigration {  public function __construct() {     parent::__construct();     $this->description = t('loads profiles data docinfo profile');      /********* source *********/     // mysql database source    $query = database::getconnection('default', 'default')             ->select('docinfo', 'u')             ->fields('u', array('uid',                                 'first',                                 'last',                                 'phone',                                 'phonetype',                                 'dob',                                 'gender',                                 'membertype',                                 'year',                                 'make',                                 'model',                                 'new_used',                                 'tshirt_it',                                 'street',                                 'apt',                                 'city',                                 'state',                                 'zipcode'));     $this->source = new migratesourcesql($query);      $this->destination = new migratedestinationprofile2('doc_info'); // use machine name of profile      /*********** map **********/     // create "map" used translate primary keys*/    $this->map = new migratesqlmap($this->machinename,      array(        'uid' => array(          'type' => 'int',          'alias'=> 'u'        ),        ),      migratedestinationprofile2::getkeyschema()          );     /*********** connect docinfo user **********/    $this->addfieldmapping('uid', 'uid');     /******* field mappings ******/    $this->addfieldmapping('language')->defaultvalue('en');    $this->addfieldmapping('field_fname','first');    $this->addfieldmapping('field_fname:language')->defaultvalue('en');     $this->addfieldmapping('field_lname','last');    $this->addfieldmapping('field_lname:language')->defaultvalue('en');     $this->addfieldmapping('field_home_phone','phone');    $this->addfieldmapping('field_home_phone:language')->defaultvalue('en');    $this->addfieldmapping('field_phone_type','phonetype');     $this->addfieldmapping('field_dob','dob');    $this->addfieldmapping('field_doc_gender','gender');     $this->addfieldmapping('field_doctype','membertype');    $this->addfieldmapping('field_docbikeyear','year');    $this->addfieldmapping('field_docmake','make');    $this->addfieldmapping('field_docmodel','model');    $this->addfieldmapping('field_docmodel:language')->defaultvalue('en');    $this->addfieldmapping('field_docnewused','new_used');    $this->addfieldmapping('field_italian_t_shirt','tshirt_it');     $this->addfieldmapping('field_address:thoroughfare','street');    $this->addfieldmapping('field_address:premise','apt');    $this->addfieldmapping('field_address:locality','city');    $this->addfieldmapping('field_address:administrative_area','state');    $this->addfieldmapping('field_address:postal_code','zipcode');      /*** unmapped destination fields ***/    $this->addunmigrateddestinations(array('revision_uid',                                           'field_address',                                           'field_address:sub_administrative_area',                                           'field_address:dependent_locality',                                           'field_address:sub_premise',                                           'field_address:organisation_name',                                           'field_address:name_line',                                           'field_address:first_name',                                           'field_address:last_name',                                           'field_address:data',                                           'field_dob:timezone',                                           'field_dob:rrule',                                           'field_dob:to',));  } 

addressfield expects country in order know subfields use.

try adding before other address field mappings:

$this->addfieldmapping('field_address', 'country')      ->defaultvalue('us'); 

(followed by

$this->addfieldmapping('field_address:thoroughfare','street'); $this->addfieldmapping('field_address:premise','apt'); $this->addfieldmapping('field_address:locality','city'); 

etc.)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -