You are here

public function Pool::getNewestTimestamp in CMS Content Sync 2.1.x

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

Get the newest pull/push timestamp for this pool from all status entities that exist for the given entity.

Parameters

$entity_type:

$entity_uuid:

bool $pull:

Return value

null|int

File

src/Entity/Pool.php, line 250

Class

Pool
Defines the "Content Sync - Pool" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public function getNewestTimestamp($entity_type, $entity_uuid, $pull = true) {
  $entity_status = EntityStatus::getInfoForPool($entity_type, $entity_uuid, $this);
  $timestamp = null;
  foreach ($entity_status as $info) {
    $item_timestamp = $pull ? $info
      ->getLastPull() : $info
      ->getLastPush();
    if ($item_timestamp) {
      if (!$timestamp || $timestamp < $item_timestamp) {
        $timestamp = $item_timestamp;
      }
    }
  }
  return $timestamp;
}