You are here

public function CommerceKickstartPages::__construct in Commerce Kickstart 7.2

General initialization of a Migration object.

Overrides Migration::__construct

File

modules/commerce_kickstart/commerce_kickstart_migrate/commerce_kickstart_migrate.migrate.inc, line 33
Contains base migration classes used by other Commerce Kickstart modules.

Class

CommerceKickstartPages
Class CommerceKickstartPages.

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->description = t('Import pages nodes.');

  // Create a map object for tracking the relationships between source rows.
  $this->map = new MigrateSQLMap($this->machineName, array(
    'title' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
    ),
  ), MigrateDestinationNode::getKeySchema());

  // Create a MigrateSource object.
  $this->source = new MigrateSourceCSV(drupal_get_path('module', 'commerce_kickstart_migrate') . '/import/pages.csv', $this
    ->csvcolumns(), array(
    'header_rows' => 1,
  ));
  $this->destination = new MigrateDestinationNode('page');
  $this
    ->addFieldMapping('nid', 'nid');
  $this
    ->addFieldMapping('title', 'title');
  $this
    ->addFieldMapping('path', 'path');
  $this
    ->addFieldMapping('body', 'body');
  $this
    ->addFieldMapping('body:summary', 'excerpt');
  $this
    ->addFieldMapping('uid', 'uid')
    ->defaultValue(1);
  $this
    ->addFieldMapping('is_new', 'is_new')
    ->defaultValue(TRUE);
}