Révision 950416da
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/field_collection/field_collection.migrate.inc | ||
---|---|---|
25 | 25 |
* @see http://drupal.org/node/1900640 |
26 | 26 |
*/ |
27 | 27 |
|
28 |
// Avoid issues when migrate module is disabled. |
|
29 |
if (!class_exists('MigrateDestinationEntity')) { |
|
30 |
return; |
|
31 |
} |
|
32 |
|
|
28 | 33 |
/** |
29 | 34 |
* Destination class implementing migration into field_collection. |
30 | 35 |
*/ |
... | ... | |
84 | 89 |
* @param $row |
85 | 90 |
* Raw source data object - passed through to prepare/complete handlers. |
86 | 91 |
* |
87 |
* @return array|false
|
|
92 |
* @return array|bool
|
|
88 | 93 |
* Array of key fields (item_id only in this case) of the collection that |
89 | 94 |
* was saved or FALSE on failure. |
90 | 95 |
*/ |
... | ... | |
93 | 98 |
if (isset($row->migrate_map_destid1)) { |
94 | 99 |
// We're updated an existing entity - start from the previous data. |
95 | 100 |
// entity_load() returns an array, so we get the field collection entity |
96 |
// with array_shift(). |
|
97 |
if ($entity = array_shift(entity_load('field_collection_item', array($row->migrate_map_destid1), array(), TRUE))) { |
|
101 |
// with reset(). |
|
102 |
$result = entity_load('field_collection_item', array($row->migrate_map_destid1), array(), TRUE); |
|
103 |
$entity = reset($result); |
|
104 |
if ($entity) { |
|
98 | 105 |
$entity_old = clone $entity; |
99 | 106 |
$updating = TRUE; |
100 | 107 |
} |
... | ... | |
126 | 133 |
|
127 | 134 |
$this->prepare($entity, $row); |
128 | 135 |
|
129 |
// Restore fields from original field_collection_item if updating |
|
136 |
// Restore fields from original field_collection_item if updating.
|
|
130 | 137 |
if ($updating) { |
131 | 138 |
foreach ($entity as $field => $value) { |
132 | 139 |
if ('field_' != substr($field, 0, 6)) { |
... | ... | |
177 | 184 |
$this->completeRollback($item_id); |
178 | 185 |
return TRUE; |
179 | 186 |
} |
187 |
|
|
180 | 188 |
} |
181 | 189 |
|
182 | 190 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules