public static function migrateOfferings($gxpLocationId) {
    $migration = \Drupal::service('plugin.manager.migration')->createInstance('gxp_offerings_import');
    if (!$migration) {
        drupal_set_message(t('Migration @gxp_offerings_import does not exist. Please check script that builds CSV file for import.', ['@gxp_offerings_import' => 'gxp_offerings_import']), 'warning');
        return TRUE;
    }

    $source = $migration->getSourceConfiguration();
    $publicPath = \Drupal::service('file_system')->realpath('public://');

    $filePath = $publicPath . '/' . self::FOLDER . '/programs-' . $gxpLocationId . '.csv';
    if (!file_exists($filePath)) {
      drupal_set_message(t('File @file does not exist. Please check script that builds CSV file for import.', ['@file' => $filePath]), 'error');
      return;
    }

    $config = \Drupal::configFactory()->get('openy_gxp.settings');
    \Drupal::logger('openy_gxp')->info('Start migrating location @file, @url', [
      '@file' => $filePath,
      '@url' => 'https://www.groupexpro.com/gxp/api/' . 'openy/view/' . $config->get('client_id') . '/' . $gxpLocationId,
    ]);

    $source['path'] = $filePath;
    $migration->set('source', $source);

    $executable = new MigrateExecutable($migration, new MigrateMessage());
    $executable->import();
    $migration->setStatus(\Drupal\migrate\Plugin\MigrationInterface::STATUS_IDLE);
  }
public static function migrateOfferings($gxpLocationId) {
    $migration = \Drupal::service('plugin.manager.migration')->createInstance('gxp_offerings_import');
    if (!$migration) {
        drupal_set_message(t('Migration @gxp_offerings_import does not exist. Please check script that builds CSV file for import.', ['@gxp_offerings_import' => 'gxp_offerings_import']), 'warning');
        return TRUE;
    }

    $source = $migration->getSourceConfiguration();
    $publicPath = \Drupal::service('file_system')->realpath('public://');

    $filePath = $publicPath . '/' . self::FOLDER . '/programs-' . $gxpLocationId . '.csv';
    if (!file_exists($filePath)) {
      drupal_set_message(t('File @file does not exist. Please check script that builds CSV file for import.', ['@file' => $filePath]), 'error');
      return;
    }

    $config = \Drupal::configFactory()->get('openy_gxp.settings');
    \Drupal::logger('openy_gxp')->info('Start migrating location @file, @url', [
      '@file' => $filePath,
      '@url' => 'https://www.groupexpro.com/gxp/api/' . 'openy/view/' . $config->get('client_id') . '/' . $gxpLocationId,
    ]);

    $source['path'] = $filePath;
    $migration->set('source', $source);

    $executable = new MigrateExecutable($migration, new MigrateMessage());
    $executable->import();
    $migration->setStatus(\Drupal\migrate\Plugin\MigrationInterface::STATUS_IDLE);
  }
public static function migrateOfferings ( $ gxpLocationId ) { $ migration = \ Drupal :: service ( 'plugin.manager.migration' ) -> createInstance ( 'gxp_offerings_import' ) ; if ( ! $ migration ) { drupal_set_message ( t ( 'Migration @gxp_offerings_import does not exist. Please check script that builds CSV file for import.' , [ '@gxp_offerings_import' => 'gxp_offerings_import' ] ) , 'warning' ) ; return TRUE ; } $ source = $ migration -> getSourceConfiguration ( ) ; $ publicPath = \ Drupal :: service ( 'file_system' ) -> realpath ( 'public://' ) ; $ filePath = $ publicPath . '/' . self :: FOLDER . '/programs-' . $ gxpLocationId . '.csv' ; if ( ! file_exists ( $ filePath ) ) { drupal_set_message ( t ( 'File @file does not exist. Please check script that builds CSV file for import.' , [ '@file' => $ filePath ] ) , 'error' ) ; return ; } $ config = \ Drupal :: configFactory ( ) -> get ( 'openy_gxp.settings' ) ; \ Drupal :: logger ( 'openy_gxp' ) -> info ( 'Start migrating location @file, @url' , [ '@file' => $ filePath , '@url' => 'https://www.groupexpro.com/gxp/api/' . 'openy/view/' . $ config -> get ( 'client_id' ) . '/' . $ gxpLocationId , ] ) ; $ source [ 'path' ] = $ filePath ; $ migration -> set ( 'source' , $ source ) ; $ executable = new MigrateExecutable ( $ migration , new MigrateMessage ( ) ) ; $ executable -> import ( ) ; $ migration -> setStatus ( \ Drupal \ migrate \ Plugin \ MigrationInterface :: STATUS_IDLE ) ; }
Migrate offerings.
Migrate offerings .