You are here

public function ForwardLog::import in Forward 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/migrate/destination/ForwardLog.php \Drupal\forward\Plugin\migrate\destination\ForwardLog::import()
  2. 8 src/Plugin/migrate/destination/ForwardLog.php \Drupal\forward\Plugin\migrate\destination\ForwardLog::import()
  3. 8.2 src/Plugin/migrate/destination/ForwardLog.php \Drupal\forward\Plugin\migrate\destination\ForwardLog::import()
  4. 4.0.x src/Plugin/migrate/destination/ForwardLog.php \Drupal\forward\Plugin\migrate\destination\ForwardLog::import()

Import the row.

Derived classes must implement import(), to construct one new object (pre-populated) using ID mappings in the Migration.

Parameters

\Drupal\migrate\Row $row: The row object.

array $old_destination_id_values: (optional) The old destination IDs. Defaults to an empty array.

Return value

array|bool An indexed array of destination IDs in the same order as defined in the plugin's getIds() method if the plugin wants to save the IDs to the ID map, TRUE to indicate success without saving IDs to the ID map, or FALSE to indicate a failure.

Overrides MigrateDestinationInterface::import

File

src/Plugin/migrate/destination/ForwardLog.php, line 20

Class

ForwardLog
Drupal 8 destination for forward logs.

Namespace

Drupal\forward\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = []) {
  $destination = $row
    ->getDestination();
  $this->database
    ->insert('forward_log')
    ->fields([
    'type' => $destination['type'],
    'id' => intval($destination['id']),
    'path' => $destination['path'],
    'action' => $destination['action'],
    'timestamp' => $destination['timestamp'],
    'uid' => $destination['uid'],
    'hostname' => $destination['hostname'],
  ])
    ->execute();
  return [
    $row
      ->getDestinationProperty('type'),
    $row
      ->getDestinationProperty('id'),
  ];
}