You are here

public function PrivateMessageThread::getLastAccessTime in Private Message 8

Get the last access time object for the given user.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user whose last access time should be retrieved.

Return value

Drupal\private_message\Entity\PrivateMessageThreadAccessTimeInterface The PrivateMessagegThreadAccessTime object for the user's last access of the thread.

Overrides PrivateMessageThreadInterface::getLastAccessTime

2 calls to PrivateMessageThread::getLastAccessTime()
PrivateMessageThread::getLastAccessTimestamp in src/Entity/PrivateMessageThread.php
Get the last access timestamp for the given user.
PrivateMessageThread::updateLastAccessTime in src/Entity/PrivateMessageThread.php
Update the last access time for the given user.

File

src/Entity/PrivateMessageThread.php, line 158

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function getLastAccessTime(AccountInterface $account) {
  $private_message_last_access = FALSE;
  foreach ($this
    ->get('last_access_time') as $last_access_time) {
    if ($last_access_time->entity
      ->getOwnerId() == $account
      ->id()) {
      $private_message_last_access = $last_access_time;
      break;
    }
  }
  return $private_message_last_access;
}