You are here

function pmtimetracking_migrate_field_data in Drupal PM (Project Management) 8

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

Migrate pmtimetracking node fields data to drupal user bundle.

1 call to pmtimetracking_migrate_field_data()
pmtimetracking_migrate in pmtimetracking/includes/pmtimetracking.migrate.inc
Helper function for migrating between pmtimetracking to drupal fields.

File

pmtimetracking/includes/pmtimetracking.migrate.inc, line 69
Migration functions for the PM Timetracking module.

Code

function pmtimetracking_migrate_field_data(&$sandbox) {
  $results = db_select('pmtimetracking', 'pmt')
    ->fields('pmt')
    ->condition('vid', $sandbox['pmtimetracking_current_vid_of_field_being_migrated'], '>')
    ->range(0, PMTIMETRACKING_MIGRATE_MAX_JOB_PER_BATCH)
    ->execute();
  $count = 0;
  foreach ($results as $pmtimetracking) {
    $count++;
    $sandbox['pmtimetracking_current_vid_of_field_being_migrated'] = $pmtimetracking->vid;
    try {
      _pmtimetracking_migrate_migrate_single_node($pmtimetracking->nid, $pmtimetracking->vid, $pmtimetracking);
    } catch (Exception $exc) {
      watchdog('pmtimetracking', 'See ' . __FUNCTION__ . '() ' . $exc
        ->getTraceAsString(), NULL, WATCHDOG_ERROR);
    }
  }
  return empty($count);
}