1. 8.5.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface
  2. 8.0.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface
  3. 8.1.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface
  4. 8.2.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface
  5. 8.3.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface
  6. 8.4.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface
  7. 8.6.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php MigrateSourceInterface

Defines an interface for migrate sources.

Hierarchy

Expanded class hierarchy of MigrateSourceInterface

All classes that implement MigrateSourceInterface

See also

\Drupal\migrate\Plugin\MigratePluginManager

\Drupal\migrate\Annotation\MigrateSource

\Drupal\migrate\Plugin\migrate\source\SourcePluginBase

Plugin API

Related topics

5 files declare their use of MigrateSourceInterface
migrate.api.php in core/modules/migrate/migrate.api.php
Hooks provided by the Migrate module.
migrate_prepare_row_test.module in core/modules/migrate/tests/modules/migrate_prepare_row_test/migrate_prepare_row_test.module
Test module for testing the migration source plugin prepareRow() exception handling.
MigrationTest.php in core/modules/migrate/tests/src/Unit/MigrationTest.php
Contains \Drupal\Tests\migrate\Unit\MigrationTest.
MigrationTest.php in core/modules/migrate/tests/src/Unit/process/MigrationTest.php
SourcePluginBase.php in core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php

File

core/modules/migrate/src/Plugin/MigrateSourceInterface.php, line 18

Namespace

Drupal\migrate\Plugin
View source
interface MigrateSourceInterface extends \Countable, \Iterator, PluginInspectionInterface {

  /**
   * Returns available fields on the source.
   *
   * @return array
   *   Available fields in the source, keys are the field machine names as used
   *   in field mappings, values are descriptions.
   */
  public function fields();

  /**
   * Adds additional data to the row.
   *
   * @param \Drupal\Migrate\Row $row
   *   The row object.
   *
   * @return bool
   *   FALSE if this row needs to be skipped.
   */
  public function prepareRow(Row $row);

  /**
   * Allows class to decide how it will react when it is treated like a string.
   */
  public function __toString();

  /**
   * Defines the source fields uniquely identifying a source row.
   *
   * None of these fields should contain a NULL value. If necessary, use
   * prepareRow() or hook_migrate_prepare_row() to rewrite NULL values to
   * appropriate empty values (such as '' or 0).
   *
   * @return 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 source primary key that is defined by an integer and a
   *   string, the returned value might look like:
   *   @code
   *     return [
   *       'id' => [
   *         'type' => 'integer',
   *         'unsigned' => FALSE,
   *         'size' => 'big',
   *       ],
   *       'version' => [
   *         'type' => 'string',
   *         'max_length' => 64,
   *         'is_ascii' => TRUE,
   *       ],
   *     ];
   *   @endcode
   *   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:
   *   @code
   *     return [
   *       'format' => [
   *         'type' => 'text.format',
   *       ],
   *     ];
   *   @endcode
   *   Additional custom keys/values, that are not part of field storage
   *   definition, can be passed in definitions. The most common setting, passed
   *   along the ID definition, is 'alias' used by SqlBase source plugin:
   *   @code
   *     return [
   *       'nid' => [
   *         'type' => 'integer',
   *         'alias' => 'n',
   *       ],
   *     ];
   *   @endcode
   *
   * @see \Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings()
   * @see \Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem
   * @see \Drupal\Core\Field\Plugin\Field\FieldType\StringItem
   * @see \Drupal\text\Plugin\Field\FieldType\TextItem
   * @see \Drupal\migrate\Plugin\migrate\source\SqlBase
   */
  public function getIds();

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
MigrateSourceInterface::fields public function Returns available fields on the source.
MigrateSourceInterface::getIds public function Defines the source fields uniquely identifying a source row.
MigrateSourceInterface::prepareRow public function Adds additional data to the row.
MigrateSourceInterface::__toString public function Allows class to decide how it will react when it is treated like a string.
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation.
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance.