Skip to content
Snippets Groups Projects

Mark the referenced entities as syncing before saving

1 file
+ 7
0
Compare changes
  • Side-by-side
  • Inline
+ 7
0
@@ -5,6 +5,7 @@ namespace Drupal\simple_entity_merge;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\SynchronizableInterface;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Core\Entity\ContentEntityType;
@@ -74,6 +75,9 @@ class SimpleEntityMerge {
$reference->target_id = $entity_destination_id;
}
}
if ($referencing_entity instanceof SynchronizableInterface) {
$referencing_entity->setSyncing(true);
}
$referencing_entity->save();
}
}
@@ -101,6 +105,9 @@ class SimpleEntityMerge {
$reference->target_id = $entity_destination_id;
}
}
if ($referencing_entity instanceof SynchronizableInterface) {
$referencing_entity->setSyncing(true);
}
$referencing_entity->save();
}
}
Loading