3 namespace Drupal\migrate\Plugin;
5 use Drupal\Component\Plugin\DerivativeInspectionInterface;
6 use Drupal\Component\Plugin\PluginInspectionInterface;
9 * Interface for migrations.
11 interface MigrationInterface extends PluginInspectionInterface, DerivativeInspectionInterface {
14 * The migration is currently not running.
16 const STATUS_IDLE = 0;
19 * The migration is currently importing.
21 const STATUS_IMPORTING = 1;
24 * The migration is currently being rolled back.
26 const STATUS_ROLLING_BACK = 2;
29 * The migration is being stopped.
31 const STATUS_STOPPING = 3;
34 * The migration has been disabled.
36 const STATUS_DISABLED = 4;
41 const MESSAGE_ERROR = 1;
46 const MESSAGE_WARNING = 2;
51 const MESSAGE_NOTICE = 3;
56 const MESSAGE_INFORMATIONAL = 4;
59 * All records have been processed.
61 const RESULT_COMPLETED = 1;
64 * The process has stopped itself (e.g., the memory limit is approaching).
66 const RESULT_INCOMPLETE = 2;
69 * The process was stopped externally (e.g., via drush migrate-stop).
71 const RESULT_STOPPED = 3;
74 * The process had a fatal error.
76 const RESULT_FAILED = 4;
79 * Dependencies are unfulfilled - skip the process.
81 const RESULT_SKIPPED = 5;
84 * This migration is disabled, skipping.
86 const RESULT_DISABLED = 6;
89 * An alias for getPluginId() for backwards compatibility reasons.
92 * The plugin_id of the plugin instance.
94 * @see \Drupal\migrate\Plugin\MigrationInterface::getPluginId()
99 * Get the plugin label.
102 * The label for this migration.
104 public function label();
107 * Returns the initialized source plugin.
109 * @return \Drupal\migrate\Plugin\MigrateSourceInterface
112 public function getSourcePlugin();
115 * Returns the process plugins.
117 * @param array $process
118 * A process configuration array.
120 * @return \Drupal\migrate\Plugin\MigrateProcessInterface[][]
121 * An associative array. The keys are the destination property names. Values
122 * are process pipelines. Each pipeline contains an array of plugins.
124 public function getProcessPlugins(array $process = NULL);
127 * Returns the initialized destination plugin.
129 * @param bool $stub_being_requested
130 * TRUE to indicate that this destination will be asked to construct a stub.
132 * @return \Drupal\migrate\Plugin\MigrateDestinationInterface
133 * The destination plugin.
135 public function getDestinationPlugin($stub_being_requested = FALSE);
138 * Returns the initialized id_map plugin.
140 * @return \Drupal\migrate\Plugin\MigrateIdMapInterface
143 public function getIdMap();
146 * Check if all source rows from this migration have been processed.
149 * TRUE if this migration is complete otherwise FALSE.
151 public function allRowsProcessed();
154 * Set the current migration status.
157 * One of the STATUS_* constants.
159 public function setStatus($status);
162 * Get the current migration status.
165 * The current migration status. Defaults to STATUS_IDLE.
167 public function getStatus();
170 * Retrieve a label for the current status.
173 * User-friendly string corresponding to a STATUS_ constant.
175 public function getStatusLabel();
178 * Get the result to return upon interruption.
181 * The current interruption result. Defaults to RESULT_INCOMPLETE.
183 public function getInterruptionResult();
186 * Clears the result to return upon interruption.
188 public function clearInterruptionResult();
191 * Signal that the migration should be interrupted with the specified result
195 * One of the MigrationInterface::RESULT_* constants.
197 public function interruptMigration($result);
200 * Get the normalized process pipeline configuration describing the process
203 * The process configuration is always normalized. All shorthand processing
204 * will be expanded into their full representations.
206 * @see https://www.drupal.org/node/2129651#get-shorthand
209 * The normalized configuration describing the process plugins.
211 public function getProcess();
214 * Allows you to override the entire process configuration.
216 * @param array $process
217 * The entire process pipeline configuration describing the process plugins.
221 public function setProcess(array $process);
224 * Set the process pipeline configuration for an individual destination field.
226 * This method allows you to set the process pipeline configuration for a
227 * single property within the full process pipeline configuration.
229 * @param string $property
230 * The property of which to set the process pipeline configuration.
231 * @param mixed $process_of_property
232 * The process pipeline configuration to be set for this property.
235 * The migration entity.
237 public function setProcessOfProperty($property, $process_of_property);
240 * Merge the process pipeline configuration for a single property.
242 * @param string $property
243 * The property of which to merge the passed in process pipeline
245 * @param array $process_of_property
246 * The process pipeline configuration to be merged with the existing process
247 * pipeline configuration.
250 * The migration entity.
252 * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField()
254 public function mergeProcessOfProperty($property, array $process_of_property);
257 * Checks if the migration should track time of last import.
260 * TRUE if the migration is tracking last import time.
262 public function isTrackLastImported();
265 * Set if the migration should track time of last import.
267 * @param bool $track_last_imported
268 * Boolean value to indicate if the migration should track last import time.
272 public function setTrackLastImported($track_last_imported);
275 * Get the dependencies for this migration.
278 * The dependencies for this migrations.
280 public function getMigrationDependencies();
283 * Get the destination configuration, with at least a 'plugin' key.
286 * The destination configuration.
288 public function getDestinationConfiguration();
291 * Get the source configuration, with at least a 'plugin' key.
294 * The source configuration.
296 public function getSourceConfiguration();
299 * If true, track time of last import.
302 * Flag to determine desire of tracking time of last import.
304 public function getTrackLastImported();
307 * The destination identifiers.
309 * An array of destination identifiers: the keys are the name of the
310 * properties, the values are dependent on the ID map plugin.
313 * Destination identifiers.
315 public function getDestinationIds();
318 * The migration tags.
323 public function getMigrationTags();