Drupal 8  8.0.2
MigrateDestinationInterface Interface Reference
Inheritance diagram for MigrateDestinationInterface:

Public Member Functions

 getIds ()
 
 fields (MigrationInterface $migration=NULL)
 
 import (Row $row, array $old_destination_id_values=array())
 
 rollback (array $destination_identifier)
 
 supportsRollback ()
 
 rollbackAction ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Detailed Description

Defines an interface for Migration Destination classes.

Destinations are responsible for persisting source data into the destination Drupal.

See Also
Plugin API

Member Function Documentation

fields ( MigrationInterface  $migration = NULL)

Returns an array of destination fields.

Derived classes must implement fields(), returning a list of available destination fields.

Todo:
Review the cases where we need the Migration parameter, can we avoid that? To be resolved with https://www.drupal.org/node/2543568.
Parameters
\Drupal\migrate\Entity\MigrationInterface$migration(optional) The migration containing this destination. Defaults to NULL.
Returns
array
  • Keys: machine names of the fields
  • Values: Human-friendly descriptions of the fields.

Implemented in Entity, Config, UrlAlias, UserData, BlockedIP, ComponentEntityDisplayBase, NullDestination, and DummyDestination.

getIds ( )

Get the destination IDs.

To support MigrateIdMap maps, derived destination classes should return schema field definition(s) corresponding to the primary key of the destination being implemented. These are used to construct the destination key fields of the map table for a migration using this destination.

Returns
array An array of IDs.

Implemented in EntityContentBase, Config, UrlAlias, EntityRevision, UserData, BlockedIP, ShortcutSetUsers, EntityConfigBase, ComponentEntityDisplayBase, NullDestination, DummyDestination, EntityFieldInstance, EntityFieldStorageConfig, and EntityViewMode.

import ( Row  $row,
array  $old_destination_id_values = array() 
)

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$rowThe row object.
array$old_destination_id_values(optional) The old destination IDs. Defaults to an empty array.
Returns
mixed The entity ID or an indication of success.

Implemented in EntityUser, EntityContentBase, BlockedIP, Config, UrlAlias, UserData, NullDestination, DummyDestination, EntityConfigBase, and ComponentEntityDisplayBase.

rollback ( array  $destination_identifier)

Delete the specified destination object from the target Drupal.

Parameters
array$destination_identifierThe ID of the destination object to delete.

Implemented in Entity, and DestinationBase.

rollbackAction ( )

The rollback action for the last imported item.

Returns
int The MigrateIdMapInterface::ROLLBACK_ constant indicating how an imported item should be handled on rollback.

Implemented in DestinationBase.

supportsRollback ( )

Whether the destination can be rolled back or not.

Returns
bool TRUE if rollback is supported, FALSE if not.

Implemented in DestinationBase.


The documentation for this interface was generated from the following file: