protected function EntityUser::processStubRow in Drupal 8
Same name and namespace in other branches
- 9 core/modules/user/src/Plugin/migrate/destination/EntityUser.php \Drupal\user\Plugin\migrate\destination\EntityUser::processStubRow()
- 10 core/modules/user/src/Plugin/migrate/destination/EntityUser.php \Drupal\user\Plugin\migrate\destination\EntityUser::processStubRow()
Populates as much of the stub row as possible.
Parameters
\Drupal\migrate\Row $row: The row of data.
Overrides EntityContentBase::processStubRow
File
- core/modules/ user/ src/ Plugin/ migrate/ destination/ EntityUser.php, line 155 
Class
- EntityUser
- Provides a destination plugin for migrating user entities.
Namespace
Drupal\user\Plugin\migrate\destinationCode
protected function processStubRow(Row $row) {
  parent::processStubRow($row);
  // Email address is not defined as required in the base field definition but
  // is effectively required by the UserMailRequired constraint. This means
  // that Entity::processStubRow() did not populate it - we do it here.
  $field_definitions = $this->entityFieldManager
    ->getFieldDefinitions($this->storage
    ->getEntityTypeId(), $this
    ->getKey('bundle'));
  $mail = EmailItem::generateSampleValue($field_definitions['mail']);
  $row
    ->setDestinationProperty('mail', reset($mail));
  // @todo Work-around for https://www.drupal.org/node/2602066.
  $name = $row
    ->getDestinationProperty('name');
  if (is_array($name)) {
    $name = reset($name);
  }
  if (mb_strlen($name) > UserInterface::USERNAME_MAX_LENGTH) {
    $row
      ->setDestinationProperty('name', mb_substr($name, 0, UserInterface::USERNAME_MAX_LENGTH));
  }
}