You are here

public function UserData::import in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/migrate/destination/UserData.php \Drupal\user\Plugin\migrate\destination\UserData::import()
  2. 9 core/modules/user/src/Plugin/migrate/destination/UserData.php \Drupal\user\Plugin\migrate\destination\UserData::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.

Throws

\Drupal\migrate\MigrateException Throws an exception if there is a problem importing the row. By default, this causes the migration system to treat this row as having failed; however, any \Drupal\migrate\Plugin\MigrateIdMapInterface status constant can be set using the $status parameter of \Drupal\migrate\MigrateException, such as \Drupal\migrate\Plugin\MigrateIdMapInterface::STATUS_IGNORED.

Overrides MigrateDestinationInterface::import

File

core/modules/user/src/Plugin/migrate/destination/UserData.php, line 59

Class

UserData
Plugin annotation @MigrateDestination( id = "user_data" )

Namespace

Drupal\user\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = []) {
  $uid = $row
    ->getDestinationProperty('uid');
  $module = $row
    ->getDestinationProperty('module');
  $key = $row
    ->getDestinationProperty('key');
  $this->userData
    ->set($module, $uid, $key, $row
    ->getDestinationProperty('settings'));
  return [
    $uid,
    $module,
    $key,
  ];
}