diff --git a/src/Plugin/migrate/process/EntityGenerate.php b/src/Plugin/migrate/process/EntityGenerate.php index f6522c1..ff14736 100644 --- a/src/Plugin/migrate/process/EntityGenerate.php +++ b/src/Plugin/migrate/process/EntityGenerate.php @@ -64,11 +64,14 @@ public function transform($value, MigrateExecutableInterface $migrateExecutable, * The entity id of the generated entity. */ protected function generateEntity($value) { - $entity = $this->entityManager + if(!empty($value)) { + $entity = $this->entityManager ->getStorage($this->lookupEntityType) ->create($this->stub($value)); - $entity->save(); - return $entity->id(); + $entity->save(); + + return $entity->id(); + } } /** diff --git a/src/Plugin/migrate/process/EntityLookup.php b/src/Plugin/migrate/process/EntityLookup.php index 2623d12..674f5bf 100644 --- a/src/Plugin/migrate/process/EntityLookup.php +++ b/src/Plugin/migrate/process/EntityLookup.php @@ -145,7 +145,7 @@ protected function determineLookupProperties($destinationProperty) { $this->lookupEntityType = $this->configuration['entity_type']; } - if (empty($this->lookupValueKey) || empty($this->lookupBundleKey) || $this->lookupBundle || empty($this->lookupEntityType)) { + if (empty($this->lookupValueKey) || empty($this->lookupBundleKey) || empty($this->lookupBundle) || empty($this->lookupEntityType)) { // See if we can introspect the lookup properties from the destination field. if (!empty($this->migration->getProcess()[$this->destinationBundleKey][0]['default_value'])) { $destinationEntityBundle = $this->migration->getProcess()[$this->destinationBundleKey][0]['default_value'];