You are here

public function SyncIntent::__construct in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/SyncIntent.php \Drupal\cms_content_sync\SyncIntent::__construct()
  2. 2.0.x src/SyncIntent.php \Drupal\cms_content_sync\SyncIntent::__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}

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

null $id:

string $source_url: The source URL if pulled or NULL if pushed from this site

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

2 calls to SyncIntent::__construct()
PullIntent::__construct in src/PullIntent.php
SyncIntent constructor.
PushIntent::__construct in src/PushIntent.php
PushIntent constructor.
2 methods override SyncIntent::__construct()
PullIntent::__construct in src/PullIntent.php
SyncIntent constructor.
PushIntent::__construct in src/PushIntent.php
PushIntent constructor.

File

src/SyncIntent.php, line 103

Class

SyncIntent
Class SyncIntent.

Namespace

Drupal\cms_content_sync

Code

public function __construct(Flow $flow, Pool $pool, $reason, $action, $entity_type, $bundle, $uuid, $id = null, $source_url = null) {
  $this->flow = $flow;
  $this->pool = $pool;
  $this->reason = $reason;
  $this->action = $action;
  $this->entityType = $entity_type;
  $this->bundle = $bundle;
  $this->uuid = $uuid;
  $this->id = $id;
  $this->entity_status = EntityStatus::getInfoForEntity($entity_type, $uuid, $flow, $pool);
  if (!$this->entity_status) {
    $this->entity_status = EntityStatus::create([
      'flow' => $this->flow->id,
      'pool' => $this->pool->id,
      'entity_type' => $entity_type,
      'entity_uuid' => $uuid,
      'entity_type_version' => Flow::getEntityTypeVersion($entity_type, $bundle),
      'flags' => 0,
      'source_url' => $source_url,
    ]);
  }
}