You are here

public function PrivateMessageThread::addMember in Private Message 8

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

Add a member to the private message thread.

Parameters

\Drupal\user\AccountInterface $account: 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::addMember

File

src/Entity/PrivateMessageThread.php, line 45

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function addMember(AccountInterface $account) {
  $this
    ->get('members')
    ->appendItem($account
    ->id());
  $this
    ->addLastAccessTime($account);
  $this
    ->addLastDeleteTime($account);
  return $this;
}