You are here

protected function ContentImporter::syncEntity in Content Synchronization 8.2

Same name and namespace in other branches
  1. 3.0.x src/Importer/ContentImporter.php \Drupal\content_sync\Importer\ContentImporter::syncEntity()

Synchronize a given entity.

Parameters

ContentEntityInterface $entity: The entity to update.

Return value

ContentEntityInterface The updated entity

1 call to ContentImporter::syncEntity()
ContentImporter::importEntity in src/Importer/ContentImporter.php

File

src/Importer/ContentImporter.php, line 184

Class

ContentImporter

Namespace

Drupal\content_sync\Importer

Code

protected function syncEntity(ContentEntityInterface $entity) {
  $preparedEntity = $this
    ->prepareEntity($entity);
  if ($this
    ->validateEntity($preparedEntity)) {
    $preparedEntity
      ->save();
    return $preparedEntity;
  }
  elseif (!$preparedEntity
    ->isNew()) {
    return $preparedEntity;
  }
  return NULL;
}