Skip to main content
removed signature
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

I can not understand how to use migrate_extras and for example how to use geofield migrate extra support.

I have create a Migration class that work. In my "source" I have 2 "fields" called latitudine and longitudine. I have follow the instruction that I have found in geofiled.inc:

$geo_arguments = array(
  'lat' => array('source_field' => 'latitudine'),
  'lon' => array('source_field' => 'longitudine'),
);
// The geometry type should be passed in as the primary value.
$this->addFieldMapping('field_coordinate', 'Point')->arguments($geo_arguments);
// Since the excerpt is mapped via an argument, add a null mapping so it's
// not flagged as unmapped.
$this->addFieldMapping(NULL, 'latitudine');
$this->addFieldMapping(NULL, 'longitudine');

But my "test node" is created (via migrate) without "geofileld" field (field_coordinate). But if I comment the lines above and insert this function:

public function prepare($node, stdClass $current_row) {
  $node->field_coordinate = array(LANGUAGE_NONE => array(0 => array(
    'geom' => 'POINT ('.$current_row->longitudine." ".$current_row->latitudine.')',
    'geo_type' => 'point',
    'lat' => $current_row->latitudine,
             'lon' => $current_row->longitudine,
             'left' => $current_row->longitudine,
             'top' => $current_row->latitudine,
             'right' =>$current_row->longitudine,
            'bottom' => $current_row->latitudine,
   )));
}

"geofield field" is "created".

Where is my error  ?

M.

I can not understand how to use migrate_extras and for example how to use geofield migrate extra support.

I have create a Migration class that work. In my "source" I have 2 "fields" called latitudine and longitudine. I have follow the instruction that I have found in geofiled.inc:

$geo_arguments = array(
  'lat' => array('source_field' => 'latitudine'),
  'lon' => array('source_field' => 'longitudine'),
);
// The geometry type should be passed in as the primary value.
$this->addFieldMapping('field_coordinate', 'Point')->arguments($geo_arguments);
// Since the excerpt is mapped via an argument, add a null mapping so it's
// not flagged as unmapped.
$this->addFieldMapping(NULL, 'latitudine');
$this->addFieldMapping(NULL, 'longitudine');

But my "test node" is created (via migrate) without "geofileld" field (field_coordinate). But if I comment the lines above and insert this function:

public function prepare($node, stdClass $current_row) {
  $node->field_coordinate = array(LANGUAGE_NONE => array(0 => array(
    'geom' => 'POINT ('.$current_row->longitudine." ".$current_row->latitudine.')',
    'geo_type' => 'point',
    'lat' => $current_row->latitudine,
             'lon' => $current_row->longitudine,
             'left' => $current_row->longitudine,
             'top' => $current_row->latitudine,
             'right' =>$current_row->longitudine,
            'bottom' => $current_row->latitudine,
   )));
}

"geofield field" is "created".

Where is my error  ?

M.

I can not understand how to use migrate_extras and for example how to use geofield migrate extra support.

I have create a Migration class that work. In my "source" I have 2 "fields" called latitudine and longitudine. I have follow the instruction that I have found in geofiled.inc:

$geo_arguments = array(
  'lat' => array('source_field' => 'latitudine'),
  'lon' => array('source_field' => 'longitudine'),
);
// The geometry type should be passed in as the primary value.
$this->addFieldMapping('field_coordinate', 'Point')->arguments($geo_arguments);
// Since the excerpt is mapped via an argument, add a null mapping so it's
// not flagged as unmapped.
$this->addFieldMapping(NULL, 'latitudine');
$this->addFieldMapping(NULL, 'longitudine');

But my "test node" is created (via migrate) without "geofileld" field (field_coordinate). But if I comment the lines above and insert this function:

public function prepare($node, stdClass $current_row) {
  $node->field_coordinate = array(LANGUAGE_NONE => array(0 => array(
    'geom' => 'POINT ('.$current_row->longitudine." ".$current_row->latitudine.')',
    'geo_type' => 'point',
    'lat' => $current_row->latitudine,
             'lon' => $current_row->longitudine,
             'left' => $current_row->longitudine,
             'top' => $current_row->latitudine,
             'right' =>$current_row->longitudine,
            'bottom' => $current_row->latitudine,
   )));
}

"geofield field" is "created".

Where is my error?

Source Link
ZioBudda
  • 1.2k
  • 2
  • 11
  • 33

How to use geofield migrate extras

I can not understand how to use migrate_extras and for example how to use geofield migrate extra support.

I have create a Migration class that work. In my "source" I have 2 "fields" called latitudine and longitudine. I have follow the instruction that I have found in geofiled.inc:

$geo_arguments = array(
  'lat' => array('source_field' => 'latitudine'),
  'lon' => array('source_field' => 'longitudine'),
);
// The geometry type should be passed in as the primary value.
$this->addFieldMapping('field_coordinate', 'Point')->arguments($geo_arguments);
// Since the excerpt is mapped via an argument, add a null mapping so it's
// not flagged as unmapped.
$this->addFieldMapping(NULL, 'latitudine');
$this->addFieldMapping(NULL, 'longitudine');

But my "test node" is created (via migrate) without "geofileld" field (field_coordinate). But if I comment the lines above and insert this function:

public function prepare($node, stdClass $current_row) {
  $node->field_coordinate = array(LANGUAGE_NONE => array(0 => array(
    'geom' => 'POINT ('.$current_row->longitudine." ".$current_row->latitudine.')',
    'geo_type' => 'point',
    'lat' => $current_row->latitudine,
             'lon' => $current_row->longitudine,
             'left' => $current_row->longitudine,
             'top' => $current_row->latitudine,
             'right' =>$current_row->longitudine,
            'bottom' => $current_row->latitudine,
   )));
}

"geofield field" is "created".

Where is my error ?

M.