You are here

public function PrivateMessageService::getThreadFromMessage in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Service/PrivateMessageService.php \Drupal\private_message\Service\PrivateMessageService::getThreadFromMessage()

Load the thread that a private message belongs to.

Parameters

\Drupal\private_message\Entity\PrivateMessageInterface $privateMessage: The private message for which the thread it belongs to should be returned.

Return value

\Drupal\private_message\Entity\PrivateMessageThread The private message thread to which the private message belongs

Overrides PrivateMessageServiceInterface::getThreadFromMessage

File

src/Service/PrivateMessageService.php, line 324

Class

PrivateMessageService
The Private Message service for the private message module.

Namespace

Drupal\private_message\Service

Code

public function getThreadFromMessage(PrivateMessageInterface $privateMessage) {
  $thread_id = $this->mapper
    ->getThreadIdFromMessage($privateMessage);
  if ($thread_id) {
    return $this->pmThreadManager
      ->load($thread_id);
  }
  return FALSE;
}