You are here

protected function StateInformation::entityHasChanged in Entity Share 8.3

Checks if the entity has changed on Remote before import.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity being imported.

int $remote_changed_time: The timestamp of "changed" date on Remote.

Return value

bool Whether the entity has changed on Remote before import.

1 call to StateInformation::entityHasChanged()
StateInformation::getStatusInfo in modules/entity_share_client/src/Service/StateInformation.php
Check if an entity already exists or not and get status info.

File

modules/entity_share_client/src/Service/StateInformation.php, line 224

Class

StateInformation
Service to handle presentation of import state.

Namespace

Drupal\entity_share_client\Service

Code

protected function entityHasChanged(ContentEntityInterface $entity, int $remote_changed_time) {

  // We are determining if the entity has changed by comparing the dates.
  // The last import date must be after the remote changed date, otherwise
  // the entity has changed.
  $import_status_entity = $this
    ->getImportStatusOfEntity($entity);
  if ($import_status_entity) {
    return $import_status_entity
      ->getLastImport() < $remote_changed_time;
  }
  else {
    return $entity
      ->getChangedTime() != $remote_changed_time;
  }
}