Menu

## MessageThread
in package
implements SaveableInterface Uses Saveable

MessageThread.php : 21

A Thread of messages.

##### Tags

Entity

  (repositoryClass="LotGD\Core\Models\Repositories\MessageThreadRepository")

Table

  (name="message_threads")

### Interfaces, Classes and Traits

SaveableInterface
  Interface for createable models.

### Table of Contents

$id : mixed
$messages : mixed
$participants : mixed
$readonly : mixed
$threadKey : mixed
__construct() : mixed
  Constructor. Sets the (unique) threadKey.
_save() : mixed
  Static, protected save function to call from trait-overwriting methods.
addMessage() : mixed
getId() : int
  Returns the primary id of this message.
getMessages() : Collection
  Returns a list of messages inside this thread.
getParticipants() : Collection
  Get a collection of participants in this thread.
isReadonly() : bool
  Returns true if the thread is "readonly".
save() : mixed
  Persists the MessageThread and adds itself to the participants.

### Properties

#### $id

MessageThread.php : 26
`private mixed $id`

##### Tags

Id

  @Column(type="integer") @GeneratedValue

#### $messages

MessageThread.php : 34
`private mixed $messages`

##### Tags

OneToMany

  (targetEntity="Message", mappedBy="thread", cascade={"persist"})

#### $participants

MessageThread.php : 32
`private mixed $participants`

##### Tags

ManyToMany

  (targetEntity="Character", cascade={"persist"}, mappedBy="messageThreads")

#### $readonly

MessageThread.php : 30
`private mixed $readonly = false`

##### Tags

Column

  (type="boolean", options={"default"=false})

#### $threadKey

MessageThread.php : 28
`private mixed $threadKey`

##### Tags

Column

  (type="string", length=255, unique=true)

### Methods

#### __construct()

MessageThread.php : 42

Constructor. Sets the (unique) threadKey.

`public __construct(string $threadKey, array<string|int, mixed> $participants[, bool $readonly = false ]) : mixed`

##### Parameters

$threadKey : string
$participants : array<string|int, mixed>
$readonly : bool = false

##### Return values

mixed —

#### _save()

Saveable.php : 21

Static, protected save function to call from trait-overwriting methods.

`public static _save(SaveableInterface $object, EntityManagerInterface $em) : mixed`

##### Parameters

$object : SaveableInterface
$em : EntityManagerInterface

##### Return values

mixed —

#### addMessage()

MessageThread.php : 78
`public addMessage(Message $message) : mixed`

##### Parameters

$message : Message

##### Tags

throws
  CoreException

##### Return values

mixed —

#### getId()

MessageThread.php : 59

Returns the primary id of this message.

`public getId() : int`

##### Return values

int —

#### getMessages()

MessageThread.php : 68

Returns a list of messages inside this thread.

`public getMessages() : Collection`

##### Return values

Collection —

#### getParticipants()

MessageThread.php : 90

Get a collection of participants in this thread.

`public getParticipants() : Collection`

##### Return values

Collection —

#### isReadonly()

MessageThread.php : 99

Returns true if the thread is "readonly".

`public isReadonly() : bool`

##### Return values

bool —

#### save()

MessageThread.php : 108

Persists the MessageThread and adds itself to the participants.

`public save(EntityManagerInterface $em) : mixed`

##### Parameters

$em : EntityManagerInterface

##### Return values

mixed —

## Search results