You are here

public function PrivateMessageThread::addHistoryRecord in Private Message 8.2

Add a history record to the current thread for the given user.

Parameters

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

Overrides PrivateMessageThreadInterface::addHistoryRecord

1 call to PrivateMessageThread::addHistoryRecord()
PrivateMessageThread::postSave in src/Entity/PrivateMessageThread.php
Acts on a saved entity before the insert or update hook is invoked.

File

src/Entity/PrivateMessageThread.php, line 148

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function addHistoryRecord(AccountInterface $account) {
  \Drupal::database()
    ->insert('pm_thread_history')
    ->fields([
    'uid' => $account
      ->id(),
    'thread_id' => $this
      ->id(),
  ])
    ->execute();
}