Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityUser.php

function EntityUser::processStubRow

Overrides EntityContentBase::processStubRow

File

core/modules/user/src/Plugin/migrate/destination/EntityUser.php, line 157

Class

EntityUser
Provides a destination plugin for migrating user entities.

Namespace

Drupal\user\Plugin\migrate\destination

Code

protected function processStubRow(Row $row) {
    parent::processStubRow($row);
    $field_definitions = $this->entityFieldManager
        ->getFieldDefinitions($this->storage
        ->getEntityTypeId(), $this->getKey('bundle'));
    // Name is generated using a dedicated sample value generator to ensure
    // uniqueness and a valid length.
    // @todo Remove this as part of https://www.drupal.org/node/3352288.
    $name = UserNameItem::generateSampleValue($field_definitions['name']);
    $row->setDestinationProperty('name', reset($name));
    // 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.
    $mail = EmailItem::generateSampleValue($field_definitions['mail']);
    $row->setDestinationProperty('mail', reset($mail));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal