You are here

public function PrivateMessageThread::addMemberById in Private Message 8

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

Add a member to the private message thread.

Parameters

int $id: The ID of the account to be set as a member of the private message thread.

Return value

\Drupal\private_message\Entity\PrivateMessageInterface Returns the class itself to allow for chaining.

Overrides PrivateMessageThreadInterface::addMemberById

File

src/Entity/PrivateMessageThread.php, line 56

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

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