You are here

public function PullIntent::__construct in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/PullIntent.php \Drupal\cms_content_sync\PullIntent::__construct()
  2. 2.0.x src/PullIntent.php \Drupal\cms_content_sync\PullIntent::__construct()

SyncIntent constructor.

Parameters

\Drupal\cms_content_sync\Entity\Flow $flow: {@see SyncIntent::$sync}

\Drupal\cms_content_sync\Entity\Pool $pool: {@see SyncIntent::$pool}

string $reason: {@see Flow::PUSH_*} or {@see Flow::PULL_*}

string $action: {@see ::ACTION_*}

string $entity_type: {@see SyncIntent::$entityType}

string $bundle: {@see SyncIntent::$bundle}

\EdgeBox\SyncCore\Interfaces\Syndication\IPullOperation $operation: The data provided from Sync Core for pulls. Format is the same as in ::getData()

null $parent_type:

null $parent_uuid:

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides SyncIntent::__construct

File

src/PullIntent.php, line 167

Class

PullIntent

Namespace

Drupal\cms_content_sync

Code

public function __construct(Flow $flow, Pool $pool, $reason, $action, $entity_type, $bundle, $operation, $parent_type = null, $parent_uuid = null) {
  $this->operation = $operation;
  if (EntityHandlerPluginManager::isEntityTypeConfiguration($entity_type)) {
    $entity_id = $this->operation
      ->getId();
  }
  else {
    $entity_id = null;
  }
  parent::__construct($flow, $pool, $reason, $action, $entity_type, $bundle, $this->operation
    ->getUuid(), $entity_id, $this->operation
    ->getSourceUrl());
  if ($this->operation
    ->getSourceUrl()) {
    $this->entity_status
      ->set('source_url', $this->operation
      ->getSourceUrl());
  }
  if ($parent_type && $parent_uuid) {
    $this->entity_status
      ->wasPulledEmbedded(true);
    $this->entity_status
      ->setParentEntity($parent_type, $parent_uuid);
  }
  else {
    $this->entity_status
      ->wasPulledEmbedded(false);
  }
  $this->mergeChanges = PullIntent::PULL_UPDATE_FORCE_UNLESS_OVERRIDDEN == $this->flow
    ->getEntityTypeConfig($this->entityType, $this->bundle)['import_updates'] && $this->entity_status
    ->isOverriddenLocally();
}