You are here

public function PrivateMessageThread::addLastAccessTime in Private Message 8

Add an an access time to the current thread for the given user.

Parameters

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

Overrides PrivateMessageThreadInterface::addLastAccessTime

2 calls to PrivateMessageThread::addLastAccessTime()
PrivateMessageThread::addMember in src/Entity/PrivateMessageThread.php
Add a member to the private message thread.
PrivateMessageThread::updateLastAccessTime in src/Entity/PrivateMessageThread.php
Update the last access time for the given user.

File

src/Entity/PrivateMessageThread.php, line 146

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function addLastAccessTime(AccountInterface $account) {
  $last_access_time = PrivateMessageThreadAccessTime::create([
    'owner' => $account
      ->id(),
    'access_time' => \Drupal::time()
      ->getRequestTime(),
  ]);
  $this
    ->get('last_access_time')
    ->appendItem($last_access_time);
}