diff --git a/field_collection.migrate.inc b/field_collection.migrate.inc index a5ac706..8483482 100644 --- a/field_collection.migrate.inc +++ b/field_collection.migrate.inc @@ -89,15 +89,18 @@ class MigrateDestinationFieldCollection extends MigrateDestinationEntity { * was saved or FALSE on failure. */ public function import(stdClass $collection, stdClass $row) { + $updating = FALSE; if (isset($row->migrate_map_destid1)) { // We're updated an existing entity - start from the previous data. // entity_load() returns an array, so we get the field collection entity // with array_shift(). - $entity = array_shift(entity_load('field_collection_item', array($row->migrate_map_destid1), array(), TRUE)); - $entity_old = clone $entity; - $updating = TRUE; + if ($entity = array_shift(entity_load('field_collection_item', array($row->migrate_map_destid1), array(), TRUE))) { + $entity_old = clone $entity; + $updating = TRUE; + } } - else { + + if (!$updating) { // Skip the collection if it has no host. if (empty($collection->host_entity_id)) { throw new MigrateException('Could not find host entity of the field collection to import.');