You are here

public function ImportBaseUserPictures::__construct in Import 7

General initialization of a Migration object.

Overrides Migration::__construct

File

./import.base.users.inc, line 66
Contains base user migration class.

Class

ImportBaseUserPictures

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->map = new MigrateSQLMap($this->machineName, array(
    'picture' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
    ),
  ), MigrateDestinationFile::getKeySchema());
  $this->destination = new MigrateDestinationFile('file');
  $import_path = drupal_get_path('module', 'import') . '/import/';
  $this->source = new MigrateSourceCSV($import_path . 'import.base.users.csv', $this
    ->csvcolumns(), array(
    'header_rows' => 1,
  ));
  $this
    ->addFieldMapping('value', 'picture');
  $this
    ->addFieldMapping('source_dir')
    ->defaultValue($import_path . 'images');
  $this
    ->addFieldMapping('file_replace')
    ->defaultValue(FILE_EXISTS_REPLACE);
  $this
    ->addFieldMapping('destination_file', 'filename');
  $this
    ->addFieldMapping('status')
    ->defaultValue(1);
}