You are here

function pmexpense_migrate_field_data in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmexpense/includes/pmexpense.migrate.inc \pmexpense_migrate_field_data()
  2. 7.2 pmexpense/includes/pmexpense.migrate.inc \pmexpense_migrate_field_data()

Migrate pmexpense node fields data to drupal user bundle.

1 call to pmexpense_migrate_field_data()
pmexpense_migrate in pmexpense/includes/pmexpense.migrate.inc
Helper function for migrating between pmexpense to drupal fields.

File

pmexpense/includes/pmexpense.migrate.inc, line 70
Migration functions for the PM Expense module.

Code

function pmexpense_migrate_field_data(&$sandbox) {
  $results = db_select('pmexpense', 'pmx')
    ->fields('pmx')
    ->condition('vid', $sandbox['pmexpense_current_vid_of_field_being_migrated'], '>')
    ->range(0, PMEXPENSE_MIGRATE_MAX_JOB_PER_BATCH)
    ->execute();
  $count = 0;
  foreach ($results as $pmexpense) {
    $count++;
    $sandbox['pmexpense_current_vid_of_field_being_migrated'] = $pmexpense->vid;
    try {
      _pmexpense_migrate_migrate_single_node($pmexpense->nid, $pmexpense->vid, $pmexpense);
    } catch (Exception $exc) {
      watchdog('pmexpense', 'See ' . __FUNCTION__ . '() ' . $exc
        ->getTraceAsString(), NULL, WATCHDOG_ERROR);
    }
  }
  return empty($count);
}