You are here

public function PartyB2BOrganizationPartyMigration::__construct in Party 8.2

Same name and namespace in other branches
  1. 7 starterkits/party_starterkit_b2b/party_starterkit_b2b_migrate/party_starterkit_b2b_migrate_organizations.inc \PartyB2BOrganizationPartyMigration::__construct()

File

starterkits/party_starterkit_b2b/party_starterkit_b2b_migrate/party_starterkit_b2b_migrate_organizations.inc, line 114
Support for migrate module

Class

PartyB2BOrganizationPartyMigration
Dependant migration that creates Party's from Profile2's.

Code

public function __construct() {
  parent::__construct();
  $this->description = t('Migration of organizations from Profile2 to Party entities.');
  $this->dependencies = array(
    'PartyB2BOrganizationProfile2',
  );
  $this->map = new MigrateSQLMap($this->machineName, array(
    'org_id' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationEntityAPI::getKeySchema('party'));

  // MigrateSource
  // This should be the same CSV file as the MigrateSource for PartyOrganizationProfile2 migration.
  $this->source = new MigrateSourceCSV(__DIR__ . '/org.csv', $this
    ->csvcolumns(), array(
    'header_rows' => 1,
  ));

  // MigrateDestination
  $this->destination = new MigrateDestinationEntityAPI('party', 'party');

  // Field Mappings
  $this
    ->addFieldMapping('profile2_id', 'org_id')
    ->sourceMigration('PartyB2BOrganizationProfile2');
  $this
    ->addFieldMapping('label', 'org_name');
}