// We want to create a new entity. Set enforceIsNew() FALSE is necessary
// to properly save a new entity while setting the ID. Without it, the
// system would see that the ID is already set and assume it is an update.
$entity->
enforceIsNew(FALSE
);
// Intentionally create a new revision. Setting new revision TRUE here may
// not be necessary, it is done for clarity.
$entity->
setNewRevision(TRUE
);
} else { // Attempt to set the bundle.
if ($bundle =
$this->
getBundle($row)) { $row->
setDestinationProperty($this->
getKey('bundle'
),
$bundle);
} // Stubs might need some required fields filled in.
if ($row->
isStub()) { $this->
processStubRow($row);
} $entity =
$this->storage->
create($row->
getDestination());
$entity->
enforceIsNew();
} // We need to update the entity, so that the destination row IDs are