Drupal 8  8.0.2
SourcePluginBase Class Reference
Inheritance diagram for SourcePluginBase:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
 
 prepareRow (Row $row)
 
 current ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 next ()
 
 getCurrentIds ()
 
 count ($refresh=FALSE)
 
- Public Member Functions inherited from MigrateSourceInterface
 fields ()
 
 __toString ()
 
 getIds ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Protected Member Functions

 initializeIterator ()
 
 getModuleHandler ()
 
 getIterator ()
 
 aboveHighwater (Row $row)
 
 rowChanged (Row $row)
 
 getCache ()
 

Protected Attributes

 $moduleHandler
 
 $migration
 
 $highWaterProperty
 
 $currentRow
 
 $currentSourceIds
 
 $originalHighWater
 
 $cacheCounts = FALSE
 
 $cacheKey
 
 $skipCount = FALSE
 
 $trackChanges = FALSE
 
 $mapRowAdded = FALSE
 
 $cache
 
 $idMap
 
 $iterator
 

Detailed Description

The base class for all source plugins.

See Also
Plugin API

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
MigrationInterface  $migration 
)

{}

Member Function Documentation

aboveHighwater ( Row  $row)
protected

Checks if the incoming data is newer than what we've previously imported.

Parameters
\Drupal\migrate\Row$rowThe row we're importing.
Returns
bool TRUE if the highwater value in the row is greater than our current value.

References Row\getSourceProperty().

Referenced by SourcePluginBase\next().

Here is the call graph for this function:

Here is the caller graph for this function:

count (   $refresh = FALSE)

Gets the source count.

Return a count of available source records, from the cache if appropriate. Returns -1 if the source is not countable.

Parameters
bool$refresh(optional) Whether or not to refresh the count. Defaults to FALSE.
Returns
int The count.

References SourcePluginBase\getCache(), SourcePluginBase\getIterator(), and PluginInspectionInterface\getPluginId().

Here is the call graph for this function:

current ( )

{}

getCache ( )
protected

Gets the cache object.

Returns
The cache object.

References Drupal\cache().

Referenced by SourcePluginBase\count().

Here is the call graph for this function:

Here is the caller graph for this function:

getCurrentIds ( )

Gets the currentSourceIds data member.

getIterator ( )
protected

Returns the iterator that will yield the row arrays to be processed.

Returns
The iterator that will yield the row arrays to be processed.

References SourcePluginBase\initializeIterator().

Referenced by SourcePluginBase\count(), SourcePluginBase\next(), and SourcePluginBase\rewind().

Here is the call graph for this function:

Here is the caller graph for this function:

getModuleHandler ( )
protected

Gets the module handler.

Returns
The module handler.

References Drupal\moduleHandler().

Referenced by SourcePluginBase\prepareRow().

Here is the call graph for this function:

Here is the caller graph for this function:

initializeIterator ( )
abstractprotected

Initializes the iterator with the source data.

Returns
array An array of the data for this source.

Referenced by SourcePluginBase\getIterator().

Here is the caller graph for this function:

key ( )

Gets the iterator key.

Implementation of Iterator::key - called when entering a loop iteration, returning the key of the current row. It must be a scalar - we will serialize to fulfill the requirement, but using getCurrentIds() is preferable.

next ( )

{}

The migration iterates over rows returned by the source plugin. This method determines the next row which will be processed and imported into the system.

The method tracks the source and destination IDs using the ID map plugin.

This also takes care about highwater support. Highwater allows to reimport rows from a previous migration run, which got changed in the meantime. This is done by specifying a highwater field, which is compared with the last time, the migration got executed (originalHighWater).

References SourcePluginBase\aboveHighwater(), SourcePluginBase\getIterator(), Row\getSourceIdValues(), SourcePluginBase\prepareRow(), SourcePluginBase\rowChanged(), and SourcePluginBase\valid().

Referenced by SourcePluginBase\rewind().

Here is the call graph for this function:

Here is the caller graph for this function:

prepareRow ( Row  $row)

{Adds additional data to the row.

Parameters
\Drupal\Migrate\Row$rowThe row object.
Returns
bool FALSE if this row needs to be skipped.
}

Implements MigrateSourceInterface.

References SourcePluginBase\getModuleHandler(), MigrateSkipRowException\getSaveToMap(), and Row\rehash().

Referenced by SourcePluginBase\next().

Here is the call graph for this function:

Here is the caller graph for this function:

rewind ( )

Rewinds the iterator.

Implementation of Iterator::rewind() - subclasses of MigrateSource should implement performRewind() to do any class-specific setup for iterating source records.

References SourcePluginBase\getIterator(), and SourcePluginBase\next().

Here is the call graph for this function:

rowChanged ( Row  $row)
protected

Checks if the incoming row has changed since our last import.

Parameters
\Drupal\migrate\Row$rowThe row we're importing.
Returns
bool TRUE if the row has changed otherwise FALSE.

References Row\changed().

Referenced by SourcePluginBase\next().

Here is the call graph for this function:

Here is the caller graph for this function:

valid ( )

Checks whether the iterator is currently valid.

Implementation of Iterator::valid() - called at the top of the loop, returning TRUE to process the loop and FALSE to terminate it.

Referenced by SourcePluginBase\next().

Here is the caller graph for this function:


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