class User extends FieldMigration (View source)

Plugin class for Drupal 7 user migrations dealing with fields and profiles.

Traits

Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.

Provides dependency injection friendly methods for serialization.

Provides a trait for the messenger service.

Constants

DERIVATIVE_SEPARATOR

A string which is used to separate base plugin IDs from the derivative ID.

Properties

protected string $pluginId

The plugin_id.

from  PluginBase
protected array $pluginDefinition

The plugin implementation definition.

from  PluginBase
protected array $configuration

Configuration information passed into the plugin.

from  PluginBase
protected TranslationInterface $stringTranslation

The string translation service.

from  StringTranslationTrait
protected array $_serviceIds

An array of service IDs keyed by property name used for serialization.

from  DependencySerializationTrait
protected array $_entityStorages

An array of entity type IDs keyed by the property name of their storages.

from  DependencySerializationTrait
protected MessengerInterface $messenger

The messenger.

from  MessengerTrait
protected string $id

The migration ID (machine name).

from  Migration
protected string $label

The human-readable label for the migration.

from  Migration
protected string $row

The plugin ID for the row.

from  Migration
protected array $source

The source configuration, with at least a 'plugin' key.

from  Migration
protected MigrateSourceInterface $sourcePlugin

The source plugin.

from  Migration
protected array $process

The configuration describing the process plugins.

from  Migration
protected array $processPlugins

The cached process plugins.

from  Migration
protected array $destination

The destination configuration, with at least a 'plugin' key.

from  Migration
protected MigrateDestinationInterface $destinationPlugin

The destination plugin.

from  Migration
protected array $idMap

The identifier map data.

from  Migration
protected MigrateIdMapInterface $idMapPlugin

The identifier map.

from  Migration
protected array $sourceIds

The source identifiers.

from  Migration
protected array $destinationIds

The destination identifiers.

from  Migration
protected int $sourceRowStatus

Specify value of source_row_status for current map row. Usually set by MigrateFieldHandler implementations.

from  Migration
protected bool $trackLastImported

Track time of last import if TRUE.

from  Migration
protected array $requirements

These migrations must be already executed before this migration can run.

from  Migration
protected array $migration_tags

An optional list of tags, used by the plugin manager for filtering.

from  Migration
protected bool $audit

Whether the migration is auditable.

from  Migration
protected array $migration_dependencies

These migrations, if run, must be executed before this migration.

from  Migration
protected array $dependencies

The migration's configuration dependencies.

from  Migration
protected MigrationPluginManagerInterface $migrationPluginManager

The migration plugin manager for loading other migration plugins.

from  Migration
protected MigratePluginManager $sourcePluginManager

The source plugin manager.

from  Migration
protected MigratePluginManager $processPluginManager

The process plugin manager.

from  Migration
protected MigrateDestinationPluginManager $destinationPluginManager

The destination plugin manager.

from  Migration
protected MigratePluginManager $idMapPluginManager

The ID map plugin manager.

from  Migration
protected array $statusLabels

Labels corresponding to each defined status.

from  Migration
protected bool $init

Flag indicating whether the field data has been filled already.

from  FieldMigration
protected FieldDiscoveryInterface $fieldDiscovery

The migration field discovery service.

from  FieldMigration

Methods

__construct(array $configuration, string $plugin_id, mixed $plugin_definition, MigrationPluginManagerInterface $migration_plugin_manager, MigratePluginManagerInterface $source_plugin_manager, MigratePluginManagerInterface $process_plugin_manager, MigrateDestinationPluginManager $destination_plugin_manager, MigratePluginManagerInterface $id_map_plugin_manager, FieldDiscoveryInterface $field_discovery)

Constructs a FieldMigration.

string
getPluginId()

Gets the plugin_id of the plugin instance.

string
getBaseId()

Gets the base_plugin_id of the plugin instance.

string|null
getDerivativeId()

Gets the derivative_id of the plugin instance.

array
getPluginDefinition()

Gets the definition of the plugin implementation.

bool
isConfigurable()

Determines if the plugin is configurable.

t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

formatPlural($count, $singular, $plural, array $args = [], array $options = [])

Formats a string containing a count of items.

getNumberOfPlurals($langcode = NULL)

Returns the number of plurals supported by a given language.

getStringTranslation()

Gets the string translation service.

$this
setStringTranslation(TranslationInterface $translation)

Sets the string translation service to use.

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

setMessenger(MessengerInterface $messenger)

Sets the messenger.

messenger()

Gets the messenger.

create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)

Creates an instance of the plugin.

string
id()

An alias for getPluginId() for backwards compatibility reasons.

string
label()

Get the plugin label.

getIdMapPlugin()

Retrieves the ID map plugin.

getSourcePlugin()

Returns the initialized source plugin.

MigrateProcessInterface[][]
getProcessPlugins(array $process = NULL)

Returns the process plugins.

array
getProcessNormalized(array $process)

Resolve shorthands into a list of plugin configurations.

getDestinationPlugin(bool $stub_being_requested = FALSE)

Returns the initialized destination plugin.

getIdMap()

Returns the initialized id_map plugin.

array
getRequirements()

Get a list of required plugin IDs.

checkRequirements()

Checks if requirements for this plugin are OK.

getMigrationPluginManager()

Gets the migration plugin manager.

setStatus(int $status)

Set the current migration status.

int
getStatus()

Get the current migration status.

string
getStatusLabel()

Retrieve a label for the current status.

int
getInterruptionResult()

Get the result to return upon interruption.

clearInterruptionResult()

Clears the result to return upon interruption.

interruptMigration(int $result)

Signal that the migration should be interrupted with the specified result code.

bool
allRowsProcessed()

Check if all source rows from this migration have been processed.

set($property_name, $value)

{@inheritdoc}

array
getProcess()

Get the normalized process pipeline configuration describing the process plugins.

$this
setProcess(array $process)

Allows you to override the entire process configuration.

$this
setProcessOfProperty(string $property, mixed $process_of_property)

Set the process pipeline configuration for an individual destination field.

$this
mergeProcessOfProperty(string $property, array $process_of_property)

Merge the process pipeline configuration for a single property.

bool
isTrackLastImported()

Checks if the migration should track time of last import.

$this
setTrackLastImported(bool $track_last_imported)

Set if the migration should track time of last import.

array
getMigrationDependencies()

Get the dependencies for this migration.

array
findMigrationDependencies(array $process)

Find migration dependencies from migration_lookup and sub_process plugins.

array
getDestinationConfiguration()

Get the destination configuration, with at least a 'plugin' key.

array
getSourceConfiguration()

Get the source configuration, with at least a 'plugin' key.

bool
getTrackLastImported()

If true, track time of last import.

array
getDestinationIds()

The destination identifiers.

array
getMigrationTags()

The migration tags.

bool
isAuditable()

Indicates if the migration is auditable.

Details

__construct(array $configuration, string $plugin_id, mixed $plugin_definition, MigrationPluginManagerInterface $migration_plugin_manager, MigratePluginManagerInterface $source_plugin_manager, MigratePluginManagerInterface $process_plugin_manager, MigrateDestinationPluginManager $destination_plugin_manager, MigratePluginManagerInterface $id_map_plugin_manager, FieldDiscoveryInterface $field_discovery)

Constructs a FieldMigration.

Parameters

array $configuration

A configuration array containing information about the plugin instance.

string $plugin_id

The plugin_id for the plugin instance.

mixed $plugin_definition

The plugin implementation definition.

MigrationPluginManagerInterface $migration_plugin_manager

The migration plugin manager.

MigratePluginManagerInterface $source_plugin_manager

The source migration plugin manager.

MigratePluginManagerInterface $process_plugin_manager

The process migration plugin manager.

MigrateDestinationPluginManager $destination_plugin_manager

The destination migration plugin manager.

MigratePluginManagerInterface $id_map_plugin_manager

The ID map migration plugin manager.

FieldDiscoveryInterface $field_discovery

The migration field discovery service.

string getPluginId()

Gets the plugin_id of the plugin instance.

Return Value

string

The plugin_id of the plugin instance.

string getBaseId()

Gets the base_plugin_id of the plugin instance.

Return Value

string

The base_plugin_id of the plugin instance.

string|null getDerivativeId()

Gets the derivative_id of the plugin instance.

Return Value

string|null

The derivative_id of the plugin instance NULL otherwise.

array getPluginDefinition()

Gets the definition of the plugin implementation.

Return Value

array

The plugin definition, as returned by the discovery object used by the plugin manager.

bool isConfigurable()

Determines if the plugin is configurable.

Return Value

bool

A boolean indicating whether the plugin is configurable.

protected TranslatableMarkup t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.

In order for strings to be localized, make them available in one of the ways supported by the

Parameters

string $string

A string containing the English text to translate.

array $args

(optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details.

array $options

(optional) An associative array of additional options, with the following elements:

  • 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page.
  • 'context' (defaults to the empty context): The context the source string belongs to. See the @link i18n Internationalization topic @endlink for more information about string contexts.

Return Value

TranslatableMarkup

An object that, when cast to a string, returns the translated string.

See also

FormattableMarkup::placeholderFormat
TranslatableMarkup::__construct

protected formatPlural($count, $singular, $plural, array $args = [], array $options = [])

Formats a string containing a count of items.

Parameters

$count
$singular
$plural
array $args
array $options

See also

TranslationInterface::formatPlural

protected getNumberOfPlurals($langcode = NULL)

Returns the number of plurals supported by a given language.

Parameters

$langcode

See also

PluralFormulaInterface::getNumberOfPlurals

protected TranslationInterface getStringTranslation()

Gets the string translation service.

Return Value

TranslationInterface

The string translation service.

$this setStringTranslation(TranslationInterface $translation)

Sets the string translation service to use.

Parameters

TranslationInterface $translation

The string translation service.

Return Value

$this

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

setMessenger(MessengerInterface $messenger)

Sets the messenger.

Parameters

MessengerInterface $messenger

The messenger.

MessengerInterface messenger()

Gets the messenger.

Return Value

MessengerInterface

The messenger.

static ContainerFactoryPluginInterface create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)

Creates an instance of the plugin.

Parameters

ContainerInterface $container

The container to pull out services used in the plugin.

array $configuration

A configuration array containing information about the plugin instance.

string $plugin_id

The plugin ID for the plugin instance.

mixed $plugin_definition

The plugin implementation definition.

Return Value

ContainerFactoryPluginInterface

Returns an instance of this plugin.

string id()

An alias for getPluginId() for backwards compatibility reasons.

Return Value

string

The plugin_id of the plugin instance.

string label()

Get the plugin label.

Return Value

string

The label for this migration.

MigrateIdMapInterface getIdMapPlugin()

Retrieves the ID map plugin.

Return Value

MigrateIdMapInterface

The ID map plugin.

MigrateSourceInterface getSourcePlugin()

Returns the initialized source plugin.

Return Value

MigrateSourceInterface

The source plugin.

MigrateProcessInterface[][] getProcessPlugins(array $process = NULL)

Returns the process plugins.

Parameters

array $process

A process configuration array.

Return Value

MigrateProcessInterface[][]

An associative array. The keys are the destination property names. Values are process pipelines. Each pipeline contains an array of plugins.

protected array getProcessNormalized(array $process)

Resolve shorthands into a list of plugin configurations.

Parameters

array $process

A process configuration array.

Return Value

array

The normalized process configuration.

MigrateDestinationInterface getDestinationPlugin(bool $stub_being_requested = FALSE)

Returns the initialized destination plugin.

Parameters

bool $stub_being_requested

TRUE to indicate that this destination will be asked to construct a stub.

Return Value

MigrateDestinationInterface

The destination plugin.

MigrateIdMapInterface getIdMap()

Returns the initialized id_map plugin.

Return Value

MigrateIdMapInterface

The ID map.

array getRequirements()

Get a list of required plugin IDs.

Return Value

array

checkRequirements()

Checks if requirements for this plugin are OK.

protected MigrationPluginManagerInterface getMigrationPluginManager()

Gets the migration plugin manager.

Return Value

MigrationPluginManagerInterface

The migration plugin manager.

setStatus(int $status)

Set the current migration status.

Parameters

int $status

One of the STATUS_* constants.

int getStatus()

Get the current migration status.

Return Value

int

The current migration status. Defaults to STATUS_IDLE.

string getStatusLabel()

Retrieve a label for the current status.

Return Value

string

User-friendly string corresponding to a STATUS_ constant.

int getInterruptionResult()

Get the result to return upon interruption.

Return Value

int

The current interruption result. Defaults to RESULT_INCOMPLETE.

clearInterruptionResult()

Clears the result to return upon interruption.

interruptMigration(int $result)

Signal that the migration should be interrupted with the specified result code.

Parameters

int $result

One of the MigrationInterface::RESULT_* constants.

bool allRowsProcessed()

Check if all source rows from this migration have been processed.

Return Value

bool

TRUE if this migration is complete otherwise FALSE.

set($property_name, $value)

{@inheritdoc}

Parameters

$property_name
$value

array getProcess()

Get the normalized process pipeline configuration describing the process plugins.

The process configuration is always normalized. All shorthand processing will be expanded into their full representations.

Return Value

array

The normalized configuration describing the process plugins.

$this setProcess(array $process)

Allows you to override the entire process configuration.

Parameters

array $process

The entire process pipeline configuration describing the process plugins.

Return Value

$this

$this setProcessOfProperty(string $property, mixed $process_of_property)

Set the process pipeline configuration for an individual destination field.

This method allows you to set the process pipeline configuration for a single property within the full process pipeline configuration.

Parameters

string $property

The property of which to set the process pipeline configuration.

mixed $process_of_property

The process pipeline configuration to be set for this property.

Return Value

$this

The migration entity.

$this mergeProcessOfProperty(string $property, array $process_of_property)

Merge the process pipeline configuration for a single property.

Parameters

string $property

The property of which to merge the passed in process pipeline configuration.

array $process_of_property

The process pipeline configuration to be merged with the existing process pipeline configuration.

Return Value

$this

The migration entity.

bool isTrackLastImported()

Checks if the migration should track time of last import.

Return Value

bool

TRUE if the migration is tracking last import time.

$this setTrackLastImported(bool $track_last_imported)

Set if the migration should track time of last import.

Parameters

bool $track_last_imported

Boolean value to indicate if the migration should track last import time.

Return Value

$this

array getMigrationDependencies()

Get the dependencies for this migration.

Return Value

array

The dependencies for this migrations.

protected array findMigrationDependencies(array $process)

Find migration dependencies from migration_lookup and sub_process plugins.

Parameters

array $process

A process configuration array.

Return Value

array

The migration dependencies.

array getDestinationConfiguration()

Get the destination configuration, with at least a 'plugin' key.

Return Value

array

The destination configuration.

array getSourceConfiguration()

Get the source configuration, with at least a 'plugin' key.

Return Value

array

The source configuration.

bool getTrackLastImported()

If true, track time of last import.

Return Value

bool

Flag to determine desire of tracking time of last import.

array getDestinationIds()

The destination identifiers.

An array of destination identifiers: the keys are the name of the properties, the values are dependent on the ID map plugin.

Return Value

array

Destination identifiers.

array getMigrationTags()

The migration tags.

Return Value

array

Migration tags.

bool isAuditable()

Indicates if the migration is auditable.

Return Value

bool