You are here

public function PrivateMessageThread::addLastDeleteTime in Private Message 8

Add an a delete time to the current thread for the given user.

Parameters

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

Overrides PrivateMessageThreadInterface::addLastDeleteTime

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

File

src/Entity/PrivateMessageThread.php, line 206

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function addLastDeleteTime(AccountInterface $account) {
  $last_delete_time = PrivateMessageThreadDeleteTime::create([
    'owner' => $account
      ->id(),
    'delete_time' => 0,
  ]);
  $this
    ->get('last_delete_time')
    ->appendItem($last_delete_time);
}