You are here

public static function EntityStatus::getLastPullForEntity in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::getLastPullForEntity()
  2. 2.0.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::getLastPullForEntity()

Return value

null|int

Throws

\Exception

2 calls to EntityStatus::getLastPullForEntity()
PushIntent::__construct in src/PushIntent.php
PushIntent constructor.
_cms_content_sync_add_usage_form in ./cms_content_sync.module
Add a button "Show usage" to show all sites using this content.

File

src/Entity/EntityStatus.php, line 278

Class

EntityStatus
Defines the "Content Sync - Entity Status" entity type.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function getLastPullForEntity(EntityInterface $entity) {
  $entity_status = EntityStatus::getInfosForEntity($entity
    ->getEntityTypeId(), $entity
    ->uuid());
  $latest = null;
  foreach ($entity_status as $info) {
    if ($info
      ->getLastPull() && (!$latest || $info
      ->getLastPull() > $latest)) {
      $latest = $info
        ->getLastPull();
    }
  }
  return $latest;
}