You are here

public function ShortcutSetUsers::import in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers::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: The old destination ids.

Return value

mixed The entity id or an indication of success.

Overrides MigrateDestinationInterface::import

File

core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php, line 91
Contains \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers.

Class

ShortcutSetUsers
Plugin annotation @MigrateDestination( id = "shortcut_set_users" )

Namespace

Drupal\shortcut\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = array()) {

  /** @var \Drupal\shortcut\ShortcutSetInterface $set */
  $set = $this->shortcutSetStorage
    ->load($row
    ->getDestinationProperty('set_name'));

  /** @var \Drupal\user\UserInterface $account */
  $account = User::load($row
    ->getDestinationProperty('uid'));
  $this->shortcutSetStorage
    ->assignUser($set, $account);
  return array(
    $set
      ->id(),
    $account
      ->id(),
  );
}