Skip to content

Instantly share code, notes, and snippets.

@mankyKitty
Created June 11, 2014 00:53
Show Gist options
  • Save mankyKitty/0106be91aa84d5b8465c to your computer and use it in GitHub Desktop.
Save mankyKitty/0106be91aa84d5b8465c to your computer and use it in GitHub Desktop.
Object Oriented Programming.... yeah... brilliant.
<?php
try {
migrate_instrument_start('destination import', TRUE);
$ids = $this->destination->import($this->destinationValues, $this->sourceValues);
migrate_instrument_stop('destination import');
if ($ids) {
$this->map->saveIDMapping($this->sourceValues, $ids,
$this->needsUpdate, $this->rollbackAction,
$data_row->migrate_map_hash);
$this->successes_since_feedback++;
$this->total_successes++;
}
else {
$this->map->saveIDMapping($this->sourceValues, array(),
MigrateMap::STATUS_FAILED, $this->rollbackAction,
$data_row->migrate_map_hash);
if ($this->map->messageCount() == 0) {
$message = t('New object was not saved, no error provided');
$this->saveMessage($message);
self::displayMessage($message);
}
}
}
catch (MigrateException $e) {
$this->map->saveIDMapping($this->sourceValues, array(),
$e->getStatus(), $this->rollbackAction, $data_row->migrate_map_hash);
$this->saveMessage($e->getMessage(), $e->getLevel());
self::displayMessage($e->getMessage());
}
catch (Exception $e) {
$this->map->saveIDMapping($this->sourceValues, array(),
MigrateMap::STATUS_FAILED, $this->rollbackAction,
$data_row->migrate_map_hash);
$this->handleException($e);
}
$this->total_processed++;
$this->processed_since_feedback++;
if ($this->highwaterField) {
$this->saveHighwater($this->sourceValues->{$this->highwaterField['name']});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment