You are here

public function HeartbeatService::loadByUid in Heartbeat 8

File

src/HeartbeatService.php, line 60

Class

HeartbeatService
Class HeartbeatService.

Namespace

Drupal\heartbeat

Code

public function loadByUid($uid) {
  $hid = $this->entityQuery
    ->get('heartbeat')
    ->condition('uid', $uid)
    ->condition('status', 1)
    ->sort('created', 'DESC')
    ->range(0, 1)
    ->execute();
  return $this->entityTypeManager
    ->getStorage('heartbeat')
    ->load(array_values($hid)[0]);
}