MigrateExecutable
class MigrateExecutable extends MigrateExecutable (View source)
Properties
protected OutputInterface | $output | The Symfony console output. |
|
protected array | $saveCounters | Counters of map statuses. |
|
protected int | $deleteCounter | Counter of map deletions. |
|
protected string|null | $limit | Maximum number of items to process in this migration. |
|
protected int|null | $feedback | Frequency (in items) at which progress messages should be emitted. |
|
protected bool | $showTimestamp | Show timestamp in progress message. |
|
protected bool | $showTotal | Show internal counter in progress message. |
|
protected array | $idlist | List of specific source IDs to import. |
|
protected array | $allSourceIdValues | List of all source IDs that are found in source during this migration. |
|
protected int | $counter | Count of number of items processed so far in this migration. |
|
protected bool | $preExistingItem | Whether the destination item exists before saving. |
|
protected callable[] | $listeners | List of event listeners we have registered. |
|
protected bool | $deleteMissingSourceRows | Whether to delete rows missing from source after an import. |
|
protected MigrateIdMapFilter|null | $idMap | Static cached ID map. |
|
protected bool | $exposeProgressBar | If the execution exposes a progress bar. |
|
protected ProgressBar|null | $progressBar | The Symfony progress bar. |
Methods
Constructs a new migrate executable instance.
Counts up any map save events.
Counts up any rollback events.
Reacts when the import is about to start.
Handles missing source rows after import.
Reacts on detecting a list of missing source rows after an import.
Reacts to migration completion.
Emits information on the import progress.
Reacts when the rollback is about to starts.
Reacts to rollback completion.
Emits information on the rollback execution progress.
Reacts to an item about to be imported.
Reacts aftre a row has been deleted.
Reacts to item rollback.
{@inheritdoc}
Returns the number of items created.
Returns the number of items updated.
Returns the number of items ignored.
Returns the number of items that failed.
Returns the total number of items processed.
Returns the number of items rolled back.
Resets all the per-status counters to 0.
Initializes the command progress bar if possible.
Advances the progress bar.
Removes the progress bar after operation is finished.
Unregisters all event listeners.
Details
__construct(MigrationInterface $migration, MigrateMessageInterface $message, OutputInterface $output, array $options = [])
Constructs a new migrate executable instance.
void
onMapSave(MigrateMapSaveEvent $event)
Counts up any map save events.
void
onMapDelete(MigrateMapDeleteEvent $event)
Counts up any rollback events.
void
onPreImport(MigrateImportEvent $event)
Reacts when the import is about to start.
protected void
handleMissingSourceRows(MigrationInterface $migration)
Handles missing source rows after import.
Detect if, before importing, the destination contains rows that are no
more available in the source. If we can build such a list, we dispatch
the \Drush\Drupal\Migrate\MigrateMissingSourceRowsEvent event, allowing
subscribers to perform specific actions on detected destination objects.
We also provide a default listener to this event that rolls-back the
items, if the --delete
option has been passed.
Custom subscribers, provided by third-party code, may also subscribe,
with a higher priority, to the same event, and perform different tasks,
such as unpublishing the destination entity and then stopping the event
propagation, thus avoiding the destination object rollback, even when
the--delete
option has been passed.
void
onMissingSourceRows(MigrateMissingSourceRowsEvent $event)
Reacts on detecting a list of missing source rows after an import.
Note that third-party code may subscribe to the same event, with a higher
priority, and perform different tasks, such as unpublishing the
destination entity and then stopping the event propagation, thus avoiding
the destination object deletion, even the --delete
option was passed.
void
onPostImport(MigrateImportEvent $event)
Reacts to migration completion.
protected void
importFeedbackMessage(bool $done = true)
Emits information on the import progress.
void
onPreRollback(MigrateRollbackEvent $event)
Reacts when the rollback is about to starts.
void
onPostRollback(MigrateRollbackEvent $event)
Reacts to rollback completion.
protected void
rollbackFeedbackMessage(bool $done = true)
Emits information on the rollback execution progress.
void
onPreRowSave(MigratePreRowSaveEvent $event)
Reacts to an item about to be imported.
void
onPostRowSave(MigratePostRowSaveEvent $event)
Reacts aftre a row has been deleted.
void
onPostRowDelete(MigrateRowDeleteEvent $event)
Reacts to item rollback.
void
onPrepareRow(MigratePrepareRowEvent $event)
Reacts to a new row being prepared.
protected MigrateIdMapFilter
getIdMap()
{@inheritdoc}
int
getCreatedCount()
Returns the number of items created.
int
getUpdatedCount()
Returns the number of items updated.
int
getIgnoredCount()
Returns the number of items ignored.
int
getFailedCount()
Returns the number of items that failed.
int
getProcessedCount()
Returns the total number of items processed.
Note that STATUS_NEEDS_UPDATE is not counted, since this is typically set on stubs created as side effects, not on the primary item being imported.
int
getRollbackCount()
Returns the number of items rolled back.
protected void
resetCounters()
Resets all the per-status counters to 0.
protected void
initProgressBar(MigrationInterface $migration)
Initializes the command progress bar if possible.
void
updateProgressBar()
Advances the progress bar.
void
progressFinish()
Removes the progress bar after operation is finished.
void
unregisterListeners()
Unregisters all event listeners.