You are here

public function PrivateMessageThread::addMessageById in Private Message 8

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

Add a private message by ID to the list of the messages in this thread.

Parameters

int $id: The ID of the private message to be added to the thread.

Overrides PrivateMessageThreadInterface::addMessageById

File

src/Entity/PrivateMessageThread.php, line 95

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function addMessageById($id) {
  $this
    ->get('private_messages')
    ->appendItem($id);
  return $this;
}