Commit 8fa6ca44 authored by matslats's avatar matslats

import no longer crashes if uuid already exists, skips import instead

parent 6585b427
......@@ -226,6 +226,10 @@ class DefaultContentManager implements DefaultContentManagerInterface {
$contents = $this->parseFile($file);
$class = $definition['serialization_class'];
$entity = $this->serializer->deserialize($contents, $class, 'hal_json', array('request_method' => 'POST'));
if ($this->entityTypeManager->getStorage($entity_type_id)->loadByProperties(['uuid' => $entity->uuid()])) {
drupal_set_message(t('node @uuid already exists', ['@uuid' => $entity->uuid()]));
continue;
}
$entity->enforceIsNew(TRUE);
$entity->save();
$created[$entity->uuid()] = $entity;
......
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