You are here

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

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

Return value

\Drupal\Core\Entity\EntityInterface The entity of the intent, if it already exists locally

5 calls to SyncIntent::getEntity()
PullIntent::execute in src/PullIntent.php
Pull the provided entity.
PullIntent::getViewUrl in src/PullIntent.php
PullIntent::resolveMissingDependencies in src/PullIntent.php
Resolve all references to the entity that has just been pulled if they're missing at other content.
PullIntent::saveUnresolvedDependency in src/PullIntent.php
Mark the given dependency as missing so it's automatically resolved whenever it gets pulled.
PushIntent::execute in src/PushIntent.php
Push the given entity.

File

src/SyncIntent.php, line 171

Class

SyncIntent
Class SyncIntent.

Namespace

Drupal\cms_content_sync

Code

public function getEntity() {
  if (!$this->entity) {
    if ($this->id) {
      $entity = \Drupal::entityTypeManager()
        ->getStorage($this->entityType)
        ->load($this->id);
    }
    else {
      $entity = \Drupal::service('entity.repository')
        ->loadEntityByUuid($this->entityType, $this->uuid);
    }
    if ($entity) {
      $this
        ->setEntity($entity);
    }
  }
  return $this->entity;
}