interface MigrateSourceInterface
Same name in other branches
- 9 core/modules/migrate/src/Plugin/MigrateSourceInterface.php \Drupal\migrate\Plugin\MigrateSourceInterface
- 8.9.x core/modules/migrate/src/Plugin/MigrateSourceInterface.php \Drupal\migrate\Plugin\MigrateSourceInterface
- 10 core/modules/migrate/src/Plugin/MigrateSourceInterface.php \Drupal\migrate\Plugin\MigrateSourceInterface
Defines an interface for migrate sources.
Hierarchy
- interface \Drupal\Component\Plugin\PluginInspectionInterface
- interface \Drupal\migrate\Plugin\MigrateSourceInterface extends \Drupal\migrate\Plugin\Countable \Drupal\migrate\Plugin\Iterator \Drupal\Component\Plugin\PluginInspectionInterface
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
Related topics
13 files declare their use of MigrateSourceInterface
- ContentEntity.php in core/
modules/ migrate_drupal/ src/ Plugin/ migrate/ source/ ContentEntity.php - ContentEntityTest.php in core/
modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php - forum.module in core/
modules/ forum/ forum.module - Provides discussion forums.
- migrate.api.php in core/
modules/ migrate/ migrate.api.php - Hooks provided by the Migrate module.
- MigratePrepareRowTestHooks.php in core/
modules/ migrate/ tests/ modules/ migrate_prepare_row_test/ src/ Hook/ MigratePrepareRowTestHooks.php
File
-
core/
modules/ migrate/ src/ Plugin/ MigrateSourceInterface.php, line 18
Namespace
Drupal\migrate\PluginView source
interface MigrateSourceInterface extends \Countable, \Iterator, PluginInspectionInterface {
/**
* Indicates that the source is not countable.
*/
const NOT_COUNTABLE = -1;
/**
* 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().
*
* Examples:
*
* A composite source primary key that is defined by an integer and a string
* might look like this:
* @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 added as shown below. The most common setting
* passed along to the ID definition is table 'alias', used by the SqlBase
* source plugin in order to distinguish between ambiguous column names -
* for example, when a SQL source query joins two tables with the same
* column names.
* @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();
/**
* Gets the source module providing the source data.
*
* @return string|null
* The source module or NULL if not found.
*/
public function getSourceModule();
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
MigrateSourceInterface::fields | public | function | Returns available fields on the source. | 87 |
MigrateSourceInterface::getIds | public | function | Defines the source fields uniquely identifying a source row. | 87 |
MigrateSourceInterface::getSourceModule | public | function | Gets the source module providing the source data. | 1 |
MigrateSourceInterface::NOT_COUNTABLE | constant | Indicates that the source is not countable. | ||
MigrateSourceInterface::prepareRow | public | function | Adds additional data to the row. | 1 |
MigrateSourceInterface::__toString | public | function | Allows class to decide how it will react when it is treated like a string. | 6 |
PluginInspectionInterface::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | 7 |
PluginInspectionInterface::getPluginId | public | function | Gets the plugin ID of the plugin instance. | 3 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.