You are here

public function PrivateMessageThread::updateLastDeleteTime in Private Message 8

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

Update the last delete time for the given user.

Parameters

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

Overrides PrivateMessageThreadInterface::updateLastDeleteTime

1 call to PrivateMessageThread::updateLastDeleteTime()
PrivateMessageThread::delete in src/Entity/PrivateMessageThread.php
Deletes an entity permanently.

File

src/Entity/PrivateMessageThread.php, line 254

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function updateLastDeleteTime(AccountInterface $account) {
  $private_message_delete_time = $this
    ->getLastDeleteTime($account);
  if ($private_message_delete_time) {
    $private_message_delete_time
      ->setDeleteTime(\Drupal::time()
      ->getRequestTime());
    $private_message_delete_time
      ->save();
  }
  else {
    $this
      ->addLastDeleteTime($account);
  }
}