You are here

public function LoadFromTrackingData::onLoadLocalEntity in Acquia Content Hub 8.2

Load previously imported entities from the tracking table data.

Parameters

\Drupal\acquia_contenthub\Event\LoadLocalEntityEvent $event: Data tamper event.

Throws

\Exception

File

modules/acquia_contenthub_subscriber/src/EventSubscriber/LoadLocalEntity/LoadFromTrackingData.php, line 53

Class

LoadFromTrackingData
Class LoadFromTrackingData.

Namespace

Drupal\acquia_contenthub_subscriber\EventSubscriber\LoadLocalEntity

Code

public function onLoadLocalEntity(LoadLocalEntityEvent $event) {
  $cdf = $event
    ->getCdf();
  if ($this->tracker
    ->isTracked($cdf
    ->getUuid())) {
    $entity = $this->tracker
      ->getEntityByRemoteIdAndHash($cdf
      ->getUuid());

    // No entity found, let the rest of the stack do its job.
    if (!$entity) {
      return;
    }
    $event
      ->setEntity($entity);
    $event
      ->stopPropagation();
  }
}