Mercurial > hg > isophonics-drupal-site
comparison core/modules/migrate/src/Plugin/MigrateDestinationInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | c2387f117808 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\migrate\Plugin; | |
4 | |
5 use Drupal\Component\Plugin\PluginInspectionInterface; | |
6 use Drupal\migrate\Row; | |
7 | |
8 /** | |
9 * Defines an interface for Migration Destination classes. | |
10 * | |
11 * Destinations are responsible for persisting source data into the destination | |
12 * Drupal. | |
13 * | |
14 * @see \Drupal\migrate\Plugin\destination\DestinationBase | |
15 * @see \Drupal\migrate\Plugin\MigrateDestinationPluginManager | |
16 * @see \Drupal\migrate\Annotation\MigrateDestination | |
17 * @see plugin_api | |
18 * | |
19 * @ingroup migration | |
20 */ | |
21 interface MigrateDestinationInterface extends PluginInspectionInterface { | |
22 | |
23 /** | |
24 * Gets the destination IDs. | |
25 * | |
26 * To support MigrateIdMap maps, derived destination classes should return | |
27 * field definition(s) corresponding to the primary key of the destination | |
28 * being implemented. These are used to construct the destination key fields | |
29 * of the map table for a migration using this destination. | |
30 * | |
31 * @return array[] | |
32 * An associative array of field definitions keyed by field ID. Values are | |
33 * associative arrays with a structure that contains the field type ('type' | |
34 * key). The other keys are the field storage settings as they are returned | |
35 * by FieldStorageDefinitionInterface::getSettings(). As an example, for a | |
36 * composite destination primary key that is defined by an integer and a | |
37 * string, the returned value might look like: | |
38 * @code | |
39 * return [ | |
40 * 'id' => [ | |
41 * 'type' => 'integer', | |
42 * 'unsigned' => FALSE, | |
43 * 'size' => 'big', | |
44 * ], | |
45 * 'version' => [ | |
46 * 'type' => 'string', | |
47 * 'max_length' => 64, | |
48 * 'is_ascii' => TRUE, | |
49 * ], | |
50 * ]; | |
51 * @endcode | |
52 * If 'type' points to a field plugin with multiple columns and needs to | |
53 * refer to a column different than 'value', the key of that column will be | |
54 * appended as a suffix to the plugin name, separated by dot ('.'). Example: | |
55 * @code | |
56 * return [ | |
57 * 'format' => [ | |
58 * 'type' => 'text.format', | |
59 * ], | |
60 * ]; | |
61 * @endcode | |
62 * Additional custom keys/values, that are not part of field storage | |
63 * definition, can be passed in definitions: | |
64 * @code | |
65 * return [ | |
66 * 'nid' => [ | |
67 * 'type' => 'integer', | |
68 * 'custom_setting' => 'some_value', | |
69 * ], | |
70 * ]; | |
71 * @endcode | |
72 * | |
73 * @see \Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings() | |
74 * @see \Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem | |
75 * @see \Drupal\Core\Field\Plugin\Field\FieldType\StringItem | |
76 * @see \Drupal\text\Plugin\Field\FieldType\TextItem | |
77 */ | |
78 public function getIds(); | |
79 | |
80 /** | |
81 * Returns an array of destination fields. | |
82 * | |
83 * Derived classes must implement fields(), returning a list of available | |
84 * destination fields. | |
85 * | |
86 * @param \Drupal\migrate\Plugin\MigrationInterface $migration | |
87 * Unused, will be removed before Drupal 9.0.x. Defaults to NULL. | |
88 * | |
89 * @return array | |
90 * - Keys: machine names of the fields | |
91 * - Values: Human-friendly descriptions of the fields. | |
92 */ | |
93 public function fields(MigrationInterface $migration = NULL); | |
94 | |
95 /** | |
96 * Import the row. | |
97 * | |
98 * Derived classes must implement import(), to construct one new object | |
99 * (pre-populated) using ID mappings in the Migration. | |
100 * | |
101 * @param \Drupal\migrate\Row $row | |
102 * The row object. | |
103 * @param array $old_destination_id_values | |
104 * (optional) The old destination IDs. Defaults to an empty array. | |
105 * | |
106 * @return mixed | |
107 * The entity ID or an indication of success. | |
108 */ | |
109 public function import(Row $row, array $old_destination_id_values = []); | |
110 | |
111 /** | |
112 * Delete the specified destination object from the target Drupal. | |
113 * | |
114 * @param array $destination_identifier | |
115 * The ID of the destination object to delete. | |
116 */ | |
117 public function rollback(array $destination_identifier); | |
118 | |
119 /** | |
120 * Whether the destination can be rolled back or not. | |
121 * | |
122 * @return bool | |
123 * TRUE if rollback is supported, FALSE if not. | |
124 */ | |
125 public function supportsRollback(); | |
126 | |
127 /** | |
128 * The rollback action for the last imported item. | |
129 * | |
130 * @return int | |
131 * The MigrateIdMapInterface::ROLLBACK_ constant indicating how an imported | |
132 * item should be handled on rollback. | |
133 */ | |
134 public function rollbackAction(); | |
135 | |
136 /** | |
137 * Gets the destination module handling the destination data. | |
138 * | |
139 * @return string|null | |
140 * The destination module or NULL if not found. | |
141 */ | |
142 public function getDestinationModule(); | |
143 | |
144 } |