Drupal 8  8.0.2
MigrateExecutable Class Reference
Inheritance diagram for MigrateExecutable:

Public Member Functions

 __construct (MigrationInterface $migration, MigrateMessageInterface $message, EventDispatcherInterface $event_dispatcher=NULL)
 
 import ()
 
 rollback ()
 
 saveMessage ($message, $level=MigrationInterface::MESSAGE_ERROR)
 
- Public Member Functions inherited from MigrateExecutableInterface
 processRow (Row $row, array $process=NULL, $value=NULL)
 

Protected Member Functions

 getSource ()
 
 getEventDispatcher ()
 
 currentSourceIds ()
 
 handleException (\Exception $exception, $save=TRUE)
 
 checkStatus ()
 
 memoryExceeded ()
 
 getMemoryUsage ()
 
 attemptMemoryReclaim ()
 
 formatSize ($size)
 

Protected Attributes

 $migration
 
 $sourceRowStatus
 
 $memoryThreshold = 0.85
 
 $memoryLimit
 
 $sourceIdValues
 
 $counts = array()
 
 $destinationValues
 
 $source
 
 $sourceValues
 
 $eventDispatcher
 

Detailed Description

Defines a migrate executable class.

Constructor & Destructor Documentation

__construct ( MigrationInterface  $migration,
MigrateMessageInterface  $message,
EventDispatcherInterface  $event_dispatcher = NULL 
)

Constructs a MigrateExecutable and verifies and sets the memory limit.

Parameters
\Drupal\migrate\Entity\MigrationInterface$migrationThe migration to run.
\Drupal\migrate\MigrateMessageInterface$messageThe message to record.
\Symfony\Component\EventDispatcher\EventDispatcherInterface$event_dispatcherThe event dispatcher.
Exceptions
\Drupal\migrate\MigrateException

References t().

Here is the call graph for this function:

Member Function Documentation

attemptMemoryReclaim ( )
protected

Tries to reclaim memory.

Returns
int The memory usage after reclaim.

References Drupal\entityManager().

Referenced by MigrateExecutable\memoryExceeded().

Here is the call graph for this function:

Here is the caller graph for this function:

checkStatus ( )
protected

Checks for exceptional conditions, and display feedback.

References MigrateExecutable\memoryExceeded(), MigrationInterface\RESULT_COMPLETED, and MigrationInterface\RESULT_INCOMPLETE.

Referenced by MigrateExecutable\import(), and MigrateExecutable\rollback().

Here is the call graph for this function:

Here is the caller graph for this function:

currentSourceIds ( )
protected

Fetches the key array for the current source record.

Returns
array The current source IDs.

References MigrateExecutable\getSource().

Here is the call graph for this function:

formatSize (   $size)
protected

Generates a string representation for the given byte count.

Parameters
int$sizeA size in bytes.
Returns
string A translated string representation of the size.

References format_size().

Referenced by MigrateExecutable\memoryExceeded().

Here is the call graph for this function:

Here is the caller graph for this function:

getEventDispatcher ( )
protected

Gets the event dispatcher.

Returns

References Drupal\service().

Referenced by MigrateExecutable\import(), and MigrateExecutable\rollback().

Here is the call graph for this function:

Here is the caller graph for this function:

getMemoryUsage ( )
protected

Returns the memory usage so far.

Returns
int The memory usage.

Referenced by MigrateExecutable\memoryExceeded().

Here is the caller graph for this function:

getSource ( )
protected

Returns the source.

Makes sure source is initialized based on migration settings.

Returns
The source.

Referenced by MigrateExecutable\currentSourceIds(), and MigrateExecutable\import().

Here is the caller graph for this function:

handleException ( \Exception  $exception,
  $save = TRUE 
)
protected

Takes an Exception object and both saves and displays it.

Pulls in additional information on the location triggering the exception.

Parameters
\Exception$exceptionObject representing the exception.
bool$save(optional) Whether to save the message in the migration's mapping table. Set to FALSE in contexts where this doesn't make sense.

References Error\decodeException(), and MigrateExecutable\saveMessage().

Referenced by MigrateExecutable\import().

Here is the call graph for this function:

Here is the caller graph for this function:

memoryExceeded ( )
protected

Tests whether we've exceeded the desired memory threshold.

If so, output a message.

Returns
bool TRUE if the threshold is exceeded, otherwise FALSE.

References MigrateExecutable\attemptMemoryReclaim(), MigrateExecutable\formatSize(), MigrateExecutable\getMemoryUsage(), and t().

Referenced by MigrateExecutable\checkStatus().

Here is the call graph for this function:

Here is the caller graph for this function:

rollback ( )

{Performs a rollback operation - remove previously-imported items.}

Implements MigrateExecutableInterface.

References MigrateExecutable\checkStatus(), MigrateExecutable\getEventDispatcher(), MigrationInterface\RESULT_COMPLETED, MigrationInterface\RESULT_FAILED, MigrateIdMapInterface\ROLLBACK_DELETE, MigrationInterface\STATUS_IDLE, MigrationInterface\STATUS_ROLLING_BACK, MigrationInterface\STATUS_STOPPING, and t().

Here is the call graph for this function:

saveMessage (   $message,
  $level = MigrationInterface::MESSAGE_ERROR 
)

{Passes messages through to the map class.

Parameters
string$messageThe message to record.
int$level(optional) Message severity (defaults to MESSAGE_ERROR).
}

Implements MigrateExecutableInterface.

Referenced by TestMigrateExecutable\handleException(), MigrateExecutable\handleException(), and MigrateExecutable\import().

Here is the caller graph for this function:


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