You are here

public function MigrateDestinationInterface::getIds in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/MigrateDestinationInterface.php \Drupal\migrate\Plugin\MigrateDestinationInterface::getIds()
  2. 10 core/modules/migrate/src/Plugin/MigrateDestinationInterface.php \Drupal\migrate\Plugin\MigrateDestinationInterface::getIds()

Gets the destination IDs.

To support MigrateIdMap maps, derived destination classes should return 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.

Return value

array[] An associative array of field definitions keyed by field ID. Values are associative arrays with a structure that contains the field type ('type' key). The other keys are the field storage settings as they are returned by FieldStorageDefinitionInterface::getSettings(). As an example, for a composite destination primary key that is defined by an integer and a string, the returned value might look like:

return [
  'id' => [
    'type' => 'integer',
    'unsigned' => FALSE,
    'size' => 'big',
  ],
  'version' => [
    'type' => 'string',
    'max_length' => 64,
    'is_ascii' => TRUE,
  ],
];

If 'type' points to a field plugin with multiple columns and needs to refer to a column different than 'value', the key of that column will be appended as a suffix to the plugin name, separated by dot ('.'). Example:

return [
  'format' => [
    'type' => 'text.format',
  ],
];

Additional custom keys/values, that are not part of field storage definition, can be passed in definitions:

return [
  'nid' => [
    'type' => 'integer',
    'custom_setting' => 'some_value',
  ],
];

See also

\Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings()

\Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem

\Drupal\Core\Field\Plugin\Field\FieldType\StringItem

\Drupal\text\Plugin\Field\FieldType\TextItem

12 methods override MigrateDestinationInterface::getIds()
BlockedIp::getIds in core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php
Gets the destination IDs.
Color::getIds in core/modules/color/src/Plugin/migrate/destination/Color.php
Gets the destination IDs.
ComponentEntityDisplayBase::getIds in core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php
Gets the destination IDs.
Config::getIds in core/modules/migrate/src/Plugin/migrate/destination/Config.php
Gets the destination IDs.
DummyDestination::getIds in core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php
Gets the destination IDs.

... See full list

File

core/modules/migrate/src/Plugin/MigrateDestinationInterface.php, line 78

Class

MigrateDestinationInterface
Defines an interface for Migration Destination classes.

Namespace

Drupal\migrate\Plugin

Code

public function getIds();