You are here

public function SubscriberTracker::track in Acquia Content Hub 8.2

Add tracking for an entity in a self::EXPORTED state.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which to add tracking.

string $hash: A sha1 hash of the data attribute for change management.

string|null $remote_uuid: A remote uuid if relevant.

Throws

\Exception

File

modules/acquia_contenthub_subscriber/src/SubscriberTracker.php, line 109

Class

SubscriberTracker
Subscriber Tracker database table methods.

Namespace

Drupal\acquia_contenthub_subscriber

Code

public function track(EntityInterface $entity, string $hash, $remote_uuid = NULL) {
  $values = [
    'entity_uuid' => $remote_uuid ?? $entity
      ->uuid(),
    'entity_type' => $entity
      ->getEntityTypeId(),
    'entity_id' => $entity
      ->id(),
    'last_imported' => date('c'),
  ];
  $this
    ->insertOrUpdate($values, self::IMPORTED, $hash);
}