You are here

public function LingotekContentTranslationService::setLastUpdated in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUpdated()
  2. 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUpdated()
  3. 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUpdated()
  4. 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUpdated()
  5. 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setLastUpdated()

Updates the 'updated date' time metadata to the current request time.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity which we want the document id.

int $timestamp: The timestamp we want to store.

Return value

\Drupal\Core\Entity\ContentEntityInterface Returns the entity.

Overrides LingotekContentTranslationServiceInterface::setLastUpdated

1 call to LingotekContentTranslationService::setLastUpdated()
LingotekContentTranslationService::updateDocument in src/LingotekContentTranslationService.php
Resends a document to the translation service.

File

src/LingotekContentTranslationService.php, line 2445

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function setLastUpdated(ContentEntityInterface $entity, int $timestamp) {
  if (!$entity->lingotek_metadata->entity) {
    $entity->lingotek_metadata->entity = LingotekContentMetadata::loadByTargetId($entity
      ->getEntityTypeId(), $entity
      ->id());
  }

  /** @var \Drupal\lingotek\Entity\LingotekContentMetadata $metadata */
  $metadata =& $entity->lingotek_metadata->entity;
  $metadata
    ->setLastUpdated($timestamp)
    ->save();
  return $entity;
}