Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\migrate\Plugin;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Component\Plugin\DerivativeInspectionInterface;
|
Chris@0
|
6 use Drupal\Component\Plugin\PluginInspectionInterface;
|
Chris@0
|
7
|
Chris@0
|
8 /**
|
Chris@0
|
9 * Interface for migrations.
|
Chris@0
|
10 */
|
Chris@0
|
11 interface MigrationInterface extends PluginInspectionInterface, DerivativeInspectionInterface {
|
Chris@0
|
12
|
Chris@0
|
13 /**
|
Chris@0
|
14 * The migration is currently not running.
|
Chris@0
|
15 */
|
Chris@0
|
16 const STATUS_IDLE = 0;
|
Chris@0
|
17
|
Chris@0
|
18 /**
|
Chris@0
|
19 * The migration is currently importing.
|
Chris@0
|
20 */
|
Chris@0
|
21 const STATUS_IMPORTING = 1;
|
Chris@0
|
22
|
Chris@0
|
23 /**
|
Chris@0
|
24 * The migration is currently being rolled back.
|
Chris@0
|
25 */
|
Chris@0
|
26 const STATUS_ROLLING_BACK = 2;
|
Chris@0
|
27
|
Chris@0
|
28 /**
|
Chris@0
|
29 * The migration is being stopped.
|
Chris@0
|
30 */
|
Chris@0
|
31 const STATUS_STOPPING = 3;
|
Chris@0
|
32
|
Chris@0
|
33 /**
|
Chris@0
|
34 * The migration has been disabled.
|
Chris@0
|
35 */
|
Chris@0
|
36 const STATUS_DISABLED = 4;
|
Chris@0
|
37
|
Chris@0
|
38 /**
|
Chris@0
|
39 * Migration error.
|
Chris@0
|
40 */
|
Chris@0
|
41 const MESSAGE_ERROR = 1;
|
Chris@0
|
42
|
Chris@0
|
43 /**
|
Chris@0
|
44 * Migration warning.
|
Chris@0
|
45 */
|
Chris@0
|
46 const MESSAGE_WARNING = 2;
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Migration notice.
|
Chris@0
|
50 */
|
Chris@0
|
51 const MESSAGE_NOTICE = 3;
|
Chris@0
|
52
|
Chris@0
|
53 /**
|
Chris@0
|
54 * Migration info.
|
Chris@0
|
55 */
|
Chris@0
|
56 const MESSAGE_INFORMATIONAL = 4;
|
Chris@0
|
57
|
Chris@0
|
58 /**
|
Chris@0
|
59 * All records have been processed.
|
Chris@0
|
60 */
|
Chris@0
|
61 const RESULT_COMPLETED = 1;
|
Chris@0
|
62
|
Chris@0
|
63 /**
|
Chris@0
|
64 * The process has stopped itself (e.g., the memory limit is approaching).
|
Chris@0
|
65 */
|
Chris@0
|
66 const RESULT_INCOMPLETE = 2;
|
Chris@0
|
67
|
Chris@0
|
68 /**
|
Chris@0
|
69 * The process was stopped externally (e.g., via drush migrate-stop).
|
Chris@0
|
70 */
|
Chris@0
|
71 const RESULT_STOPPED = 3;
|
Chris@0
|
72
|
Chris@0
|
73 /**
|
Chris@0
|
74 * The process had a fatal error.
|
Chris@0
|
75 */
|
Chris@0
|
76 const RESULT_FAILED = 4;
|
Chris@0
|
77
|
Chris@0
|
78 /**
|
Chris@0
|
79 * Dependencies are unfulfilled - skip the process.
|
Chris@0
|
80 */
|
Chris@0
|
81 const RESULT_SKIPPED = 5;
|
Chris@0
|
82
|
Chris@0
|
83 /**
|
Chris@0
|
84 * This migration is disabled, skipping.
|
Chris@0
|
85 */
|
Chris@0
|
86 const RESULT_DISABLED = 6;
|
Chris@0
|
87
|
Chris@0
|
88 /**
|
Chris@0
|
89 * An alias for getPluginId() for backwards compatibility reasons.
|
Chris@0
|
90 *
|
Chris@0
|
91 * @return string
|
Chris@0
|
92 * The plugin_id of the plugin instance.
|
Chris@0
|
93 *
|
Chris@0
|
94 * @see \Drupal\migrate\Plugin\MigrationInterface::getPluginId()
|
Chris@0
|
95 */
|
Chris@0
|
96 public function id();
|
Chris@0
|
97
|
Chris@0
|
98 /**
|
Chris@0
|
99 * Get the plugin label.
|
Chris@0
|
100 *
|
Chris@0
|
101 * @return string
|
Chris@0
|
102 * The label for this migration.
|
Chris@0
|
103 */
|
Chris@0
|
104 public function label();
|
Chris@0
|
105
|
Chris@0
|
106 /**
|
Chris@0
|
107 * Returns the initialized source plugin.
|
Chris@0
|
108 *
|
Chris@0
|
109 * @return \Drupal\migrate\Plugin\MigrateSourceInterface
|
Chris@0
|
110 * The source plugin.
|
Chris@0
|
111 */
|
Chris@0
|
112 public function getSourcePlugin();
|
Chris@0
|
113
|
Chris@0
|
114 /**
|
Chris@0
|
115 * Returns the process plugins.
|
Chris@0
|
116 *
|
Chris@0
|
117 * @param array $process
|
Chris@0
|
118 * A process configuration array.
|
Chris@0
|
119 *
|
Chris@0
|
120 * @return \Drupal\migrate\Plugin\MigrateProcessInterface[][]
|
Chris@0
|
121 * An associative array. The keys are the destination property names. Values
|
Chris@0
|
122 * are process pipelines. Each pipeline contains an array of plugins.
|
Chris@0
|
123 */
|
Chris@0
|
124 public function getProcessPlugins(array $process = NULL);
|
Chris@0
|
125
|
Chris@0
|
126 /**
|
Chris@0
|
127 * Returns the initialized destination plugin.
|
Chris@0
|
128 *
|
Chris@0
|
129 * @param bool $stub_being_requested
|
Chris@0
|
130 * TRUE to indicate that this destination will be asked to construct a stub.
|
Chris@0
|
131 *
|
Chris@0
|
132 * @return \Drupal\migrate\Plugin\MigrateDestinationInterface
|
Chris@0
|
133 * The destination plugin.
|
Chris@0
|
134 */
|
Chris@0
|
135 public function getDestinationPlugin($stub_being_requested = FALSE);
|
Chris@0
|
136
|
Chris@0
|
137 /**
|
Chris@0
|
138 * Returns the initialized id_map plugin.
|
Chris@0
|
139 *
|
Chris@0
|
140 * @return \Drupal\migrate\Plugin\MigrateIdMapInterface
|
Chris@0
|
141 * The ID map.
|
Chris@0
|
142 */
|
Chris@0
|
143 public function getIdMap();
|
Chris@0
|
144
|
Chris@0
|
145 /**
|
Chris@0
|
146 * Check if all source rows from this migration have been processed.
|
Chris@0
|
147 *
|
Chris@0
|
148 * @return bool
|
Chris@0
|
149 * TRUE if this migration is complete otherwise FALSE.
|
Chris@0
|
150 */
|
Chris@0
|
151 public function allRowsProcessed();
|
Chris@0
|
152
|
Chris@0
|
153 /**
|
Chris@0
|
154 * Set the current migration status.
|
Chris@0
|
155 *
|
Chris@0
|
156 * @param int $status
|
Chris@0
|
157 * One of the STATUS_* constants.
|
Chris@0
|
158 */
|
Chris@0
|
159 public function setStatus($status);
|
Chris@0
|
160
|
Chris@0
|
161 /**
|
Chris@0
|
162 * Get the current migration status.
|
Chris@0
|
163 *
|
Chris@0
|
164 * @return int
|
Chris@0
|
165 * The current migration status. Defaults to STATUS_IDLE.
|
Chris@0
|
166 */
|
Chris@0
|
167 public function getStatus();
|
Chris@0
|
168
|
Chris@0
|
169 /**
|
Chris@0
|
170 * Retrieve a label for the current status.
|
Chris@0
|
171 *
|
Chris@0
|
172 * @return string
|
Chris@0
|
173 * User-friendly string corresponding to a STATUS_ constant.
|
Chris@0
|
174 */
|
Chris@0
|
175 public function getStatusLabel();
|
Chris@0
|
176
|
Chris@0
|
177 /**
|
Chris@0
|
178 * Get the result to return upon interruption.
|
Chris@0
|
179 *
|
Chris@0
|
180 * @return int
|
Chris@0
|
181 * The current interruption result. Defaults to RESULT_INCOMPLETE.
|
Chris@0
|
182 */
|
Chris@0
|
183 public function getInterruptionResult();
|
Chris@0
|
184
|
Chris@0
|
185 /**
|
Chris@0
|
186 * Clears the result to return upon interruption.
|
Chris@0
|
187 */
|
Chris@0
|
188 public function clearInterruptionResult();
|
Chris@0
|
189
|
Chris@0
|
190 /**
|
Chris@0
|
191 * Signal that the migration should be interrupted with the specified result
|
Chris@0
|
192 * code.
|
Chris@0
|
193 *
|
Chris@0
|
194 * @param int $result
|
Chris@0
|
195 * One of the MigrationInterface::RESULT_* constants.
|
Chris@0
|
196 */
|
Chris@0
|
197 public function interruptMigration($result);
|
Chris@0
|
198
|
Chris@0
|
199 /**
|
Chris@0
|
200 * Get the normalized process pipeline configuration describing the process
|
Chris@0
|
201 * plugins.
|
Chris@0
|
202 *
|
Chris@0
|
203 * The process configuration is always normalized. All shorthand processing
|
Chris@0
|
204 * will be expanded into their full representations.
|
Chris@0
|
205 *
|
Chris@0
|
206 * @see https://www.drupal.org/node/2129651#get-shorthand
|
Chris@0
|
207 *
|
Chris@0
|
208 * @return array
|
Chris@0
|
209 * The normalized configuration describing the process plugins.
|
Chris@0
|
210 */
|
Chris@0
|
211 public function getProcess();
|
Chris@0
|
212
|
Chris@0
|
213 /**
|
Chris@0
|
214 * Allows you to override the entire process configuration.
|
Chris@0
|
215 *
|
Chris@0
|
216 * @param array $process
|
Chris@0
|
217 * The entire process pipeline configuration describing the process plugins.
|
Chris@0
|
218 *
|
Chris@0
|
219 * @return $this
|
Chris@0
|
220 */
|
Chris@0
|
221 public function setProcess(array $process);
|
Chris@0
|
222
|
Chris@0
|
223 /**
|
Chris@0
|
224 * Set the process pipeline configuration for an individual destination field.
|
Chris@0
|
225 *
|
Chris@0
|
226 * This method allows you to set the process pipeline configuration for a
|
Chris@0
|
227 * single property within the full process pipeline configuration.
|
Chris@0
|
228 *
|
Chris@0
|
229 * @param string $property
|
Chris@0
|
230 * The property of which to set the process pipeline configuration.
|
Chris@0
|
231 * @param mixed $process_of_property
|
Chris@0
|
232 * The process pipeline configuration to be set for this property.
|
Chris@0
|
233 *
|
Chris@0
|
234 * @return $this
|
Chris@0
|
235 * The migration entity.
|
Chris@0
|
236 */
|
Chris@0
|
237 public function setProcessOfProperty($property, $process_of_property);
|
Chris@0
|
238
|
Chris@0
|
239 /**
|
Chris@0
|
240 * Merge the process pipeline configuration for a single property.
|
Chris@0
|
241 *
|
Chris@0
|
242 * @param string $property
|
Chris@0
|
243 * The property of which to merge the passed in process pipeline
|
Chris@0
|
244 * configuration.
|
Chris@0
|
245 * @param array $process_of_property
|
Chris@0
|
246 * The process pipeline configuration to be merged with the existing process
|
Chris@0
|
247 * pipeline configuration.
|
Chris@0
|
248 *
|
Chris@0
|
249 * @return $this
|
Chris@0
|
250 * The migration entity.
|
Chris@0
|
251 *
|
Chris@0
|
252 * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField()
|
Chris@0
|
253 */
|
Chris@0
|
254 public function mergeProcessOfProperty($property, array $process_of_property);
|
Chris@0
|
255
|
Chris@0
|
256 /**
|
Chris@0
|
257 * Checks if the migration should track time of last import.
|
Chris@0
|
258 *
|
Chris@0
|
259 * @return bool
|
Chris@0
|
260 * TRUE if the migration is tracking last import time.
|
Chris@0
|
261 */
|
Chris@0
|
262 public function isTrackLastImported();
|
Chris@0
|
263
|
Chris@0
|
264 /**
|
Chris@0
|
265 * Set if the migration should track time of last import.
|
Chris@0
|
266 *
|
Chris@0
|
267 * @param bool $track_last_imported
|
Chris@0
|
268 * Boolean value to indicate if the migration should track last import time.
|
Chris@0
|
269 *
|
Chris@0
|
270 * @return $this
|
Chris@0
|
271 */
|
Chris@0
|
272 public function setTrackLastImported($track_last_imported);
|
Chris@0
|
273
|
Chris@0
|
274 /**
|
Chris@0
|
275 * Get the dependencies for this migration.
|
Chris@0
|
276 *
|
Chris@0
|
277 * @return array
|
Chris@0
|
278 * The dependencies for this migrations.
|
Chris@0
|
279 */
|
Chris@0
|
280 public function getMigrationDependencies();
|
Chris@0
|
281
|
Chris@0
|
282 /**
|
Chris@0
|
283 * Get the destination configuration, with at least a 'plugin' key.
|
Chris@0
|
284 *
|
Chris@0
|
285 * @return array
|
Chris@0
|
286 * The destination configuration.
|
Chris@0
|
287 */
|
Chris@0
|
288 public function getDestinationConfiguration();
|
Chris@0
|
289
|
Chris@0
|
290 /**
|
Chris@0
|
291 * Get the source configuration, with at least a 'plugin' key.
|
Chris@0
|
292 *
|
Chris@0
|
293 * @return array
|
Chris@0
|
294 * The source configuration.
|
Chris@0
|
295 */
|
Chris@0
|
296 public function getSourceConfiguration();
|
Chris@0
|
297
|
Chris@0
|
298 /**
|
Chris@0
|
299 * If true, track time of last import.
|
Chris@0
|
300 *
|
Chris@0
|
301 * @return bool
|
Chris@0
|
302 * Flag to determine desire of tracking time of last import.
|
Chris@0
|
303 */
|
Chris@0
|
304 public function getTrackLastImported();
|
Chris@0
|
305
|
Chris@0
|
306 /**
|
Chris@0
|
307 * The destination identifiers.
|
Chris@0
|
308 *
|
Chris@0
|
309 * An array of destination identifiers: the keys are the name of the
|
Chris@0
|
310 * properties, the values are dependent on the ID map plugin.
|
Chris@0
|
311 *
|
Chris@0
|
312 * @return array
|
Chris@0
|
313 * Destination identifiers.
|
Chris@0
|
314 */
|
Chris@0
|
315 public function getDestinationIds();
|
Chris@0
|
316
|
Chris@0
|
317 /**
|
Chris@0
|
318 * The migration tags.
|
Chris@0
|
319 *
|
Chris@0
|
320 * @return array
|
Chris@0
|
321 * Migration tags.
|
Chris@0
|
322 */
|
Chris@0
|
323 public function getMigrationTags();
|
Chris@0
|
324
|
Chris@14
|
325 /**
|
Chris@14
|
326 * Indicates if the migration is auditable.
|
Chris@14
|
327 *
|
Chris@14
|
328 * @return bool
|
Chris@14
|
329 */
|
Chris@14
|
330 public function isAuditable();
|
Chris@14
|
331
|
Chris@0
|
332 }
|