You are here

public function PushIntent::updateEntityStatusAfterSuccessfulPush in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/PushIntent.php \Drupal\cms_content_sync\PushIntent::updateEntityStatusAfterSuccessfulPush()
  2. 2.0.x src/PushIntent.php \Drupal\cms_content_sync\PushIntent::updateEntityStatusAfterSuccessfulPush()

Parameters

string $action:

null $parent_type:

null $parent_uuid:

1 call to PushIntent::updateEntityStatusAfterSuccessfulPush()
PushIntent::afterPush in src/PushIntent.php

File

src/PushIntent.php, line 497

Class

PushIntent
Class PushIntent.

Namespace

Drupal\cms_content_sync

Code

public function updateEntityStatusAfterSuccessfulPush($action = SyncIntent::ACTION_CREATE, $parent_type = null, $parent_uuid = null) {
  $this->entity_status
    ->setEntityPushHash($this->operation
    ->getEntityHash());
  if (!$this->entity_status
    ->getLastPush() && !$this->entity_status
    ->getLastPull() && !empty($this->operation
    ->getProperty('url'))) {
    $this->entity_status
      ->set('source_url', $this->operation
      ->getProperty('url'));
  }
  $push = $this
    ->getEntityChangedTime($this->entity);
  $this->entity_status
    ->setLastPush($push);
  if (SyncIntent::ACTION_DELETE == $action) {
    $this->entity_status
      ->isDeleted(true);
    $this->pool
      ->markDeleted($this->entity
      ->getEntityTypeId(), $this->entity
      ->uuid());
  }
  if ($this->entityVersionHash != $this->entity_status
    ->getEntityTypeVersion()) {
    $this->entity_status
      ->setEntityTypeVersion($this->entityVersionHash);
  }
  if ($parent_type && $parent_uuid) {
    $this->entity_status
      ->wasPushedEmbedded(true);
    $this->entity_status
      ->setParentEntity($parent_type, $parent_uuid);
  }
  else {
    $this->entity_status
      ->wasPushedEmbedded(false);
  }
  $this->entity_status
    ->save();
  foreach ($this->embeddedPushIntents as $intent) {
    $intent
      ->updateEntityStatusAfterSuccessfulPush(SyncIntent::ACTION_CREATE, $this->entityType, $this->uuid);
  }
}