You are here

public function PrivateMessageThread::updateLastAccessTime in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Entity/PrivateMessageThread.php \Drupal\private_message\Entity\PrivateMessageThread::updateLastAccessTime()

Update the last access time for the given user.

Parameters

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

Overrides PrivateMessageThreadInterface::updateLastAccessTime

File

src/Entity/PrivateMessageThread.php, line 190

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function updateLastAccessTime(AccountInterface $account) {
  $private_message_access_time = $this
    ->getLastAccessTime($account);
  if ($private_message_access_time) {
    $private_message_access_time->entity
      ->setAccessTime(\Drupal::time()
      ->getRequestTime())
      ->save();
  }
  else {
    $this
      ->addLastAccessTime($account);
  }
  return $this;
}