You are here

protected function EntityPublisher::defaultSave in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Service/EntityPublisher.php \Drupal\content_synchronizer\Service\EntityPublisher::defaultSave()
  2. 3.x src/Service/EntityPublisher.php \Drupal\content_synchronizer\Service\EntityPublisher::defaultSave()

Save without publish status care.

Parameters

\Drupal\Core\Entity\Entity $entity: The entity to save.

\Drupal\Core\Entity\Entity $existingEntity: The existing entity before changes.

1 call to EntityPublisher::defaultSave()
EntityPublisher::saveEntityWithUnpublishedStatus in src/Service/EntityPublisher.php
Try to unpublish entity if it needs to be created. Either default save.

File

src/Service/EntityPublisher.php, line 110

Class

EntityPublisher
THe entity publsher service.

Namespace

Drupal\content_synchronizer\Service

Code

protected function defaultSave(Entity $entity, Entity $existingEntity = NULL) {
  if ($this
    ->haveToSave($entity, $existingEntity)) {
    if (is_null($entity
      ->uuid())) {
      $entity->uuid = \Drupal::service('uuid')
        ->generate();
    }
    $entity
      ->save();
  }
}