Commit 4869c3e7 authored by jhedstrom's avatar jhedstrom Committed by Joel Muzzerall
Browse files

Issue #2315921 by jhedstrom: Fixed a fatal error that can occur during migrations.

parent 2291aebf
......@@ -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.');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment