MessageThread
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait
AbstractYes
Private conversation (container).
Messages hang on the thread, not on each other: per-user state (unread / archived / deleted for me) belongs to one participant of the conversation and a message tree would have nowhere to hold it.
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'messageThread'
Table of Contents
Interfaces
- IdentifiableInterface
- Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).
Properties
- $accessToken : string|null
- $accessTokenValidUntil : DateTime|null
- $closed : bool
- No message can be added to the thread (deleted advert, moderation).
- $deleted : bool
- Global (admin) delete. "Deleted for me" is `MessageParticipant::$deleted`.
- $id : int|null
- $insertDatetime : DateTime
- $lastMessageDatetime : DateTime|null
- $messageCount : int
- $replyChannel : MessageReplyChannel
- $subject : string|null
- $type : MessageThreadType|null
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getAccessToken() : string|null
- getAccessTokenValidUntil() : DateTime|null
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getClosed() : bool
- getDeleted() : bool
- getId() : int|null
- getInsertDatetime() : DateTime
- getLastMessageDatetime() : DateTime|null
- getMessageCount() : int
- getReplyChannel() : MessageReplyChannel
- getSubject() : string|null
- getType() : MessageThreadType|null
- isClosed() : bool
- isDeleted() : bool
- isPersisted() : bool
- isRepliableInSystem() : bool
- Can the thread be replied to directly in the system? (A guest thread offers contact details only.)
- setAccessToken() : $this
- setAccessTokenValidUntil() : $this
- setClosed() : $this
- setDeleted() : $this
- setId() : $this
- setInsertDatetime() : $this
- setLastMessageDatetime() : $this
- setMessageCount() : $this
- setReplyChannel() : $this
- setSubject() : $this
- setType() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$accessToken
protected
string|null
$accessToken
= null
Attributes
- #[Column]
- $name: 'access_token'
- $type: 'string'
- $length: 64
- $nullable: true
- #[FieldAccess]
- $read: Audience::None
- $insert: Audience::None
- $update: Audience::None
$accessTokenValidUntil
protected
DateTime|null
$accessTokenValidUntil
= null
Attributes
- #[Column]
- $name: 'access_token_valid_until'
- $type: 'datetime'
- $nullable: true
$closed
No message can be added to the thread (deleted advert, moderation).
protected
bool
$closed
= false
Attributes
- #[Column]
- $name: 'closed'
- $type: 'boolean'
$deleted
Global (admin) delete. "Deleted for me" is `MessageParticipant::$deleted`.
protected
bool
$deleted
= false
Attributes
- #[Column]
- $name: 'deleted'
- $type: 'boolean'
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'message_thread_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_datetime'
- $type: 'datetime'
$lastMessageDatetime
protected
DateTime|null
$lastMessageDatetime
= null
Attributes
- #[Column]
- $name: 'last_message_datetime'
- $type: 'datetime'
- $nullable: true
$messageCount
protected
int
$messageCount
= 0
Attributes
- #[Column]
- $name: 'message_count'
- $type: 'integer'
- $options: ['unsigned' => true]
$replyChannel
protected
MessageReplyChannel
$replyChannel
= MessageReplyChannel::System
Attributes
- #[Column]
- $name: 'reply_channel'
- $type: 'string'
- $length: 16
- $enumType: MessageReplyChannel::class
$subject
protected
string|null
$subject
= null
Attributes
- #[Column]
- $name: 'subject'
- $type: 'string'
- $length: 255
- $nullable: true
$type
protected
MessageThreadType|null
$type
= null
Attributes
- #[Column]
- $name: 'type'
- $type: 'string'
- $length: 32
- $nullable: true
- $enumType: MessageThreadType::class
Methods
__construct()
public
__construct([int|null $id = null ][, string|null $subject = null ][, MessageThreadType|null $type = null ][, MessageReplyChannel $replyChannel = MessageReplyChannel::System ][, string|null $accessToken = null ][, DateTime|null $accessTokenValidUntil = null ][, int $messageCount = 0 ][, DateTime|null $lastMessageDatetime = null ][, bool $closed = false ][, DateTime $insertDatetime = new DateTime() ][, bool $deleted = false ]) : mixed
Parameters
- $id : int|null = null
- $subject : string|null = null
- $type : MessageThreadType|null = null
- $replyChannel : MessageReplyChannel = MessageReplyChannel::System
- $accessToken : string|null = null
- $accessTokenValidUntil : DateTime|null = null
- $messageCount : int = 0
- $lastMessageDatetime : DateTime|null = null
- $closed : bool = false
- $insertDatetime : DateTime = new DateTime()
- $deleted : bool = false
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getAccessToken()
public
getAccessToken() : string|null
Return values
string|nullgetAccessTokenValidUntil()
public
getAccessTokenValidUntil() : DateTime|null
Return values
DateTime|nullgetAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getClosed()
public
getClosed() : bool
Return values
boolgetDeleted()
public
getDeleted() : bool
Return values
boolgetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetLastMessageDatetime()
public
getLastMessageDatetime() : DateTime|null
Return values
DateTime|nullgetMessageCount()
public
getMessageCount() : int
Return values
intgetReplyChannel()
public
getReplyChannel() : MessageReplyChannel
Return values
MessageReplyChannelgetSubject()
public
getSubject() : string|null
Return values
string|nullgetType()
public
getType() : MessageThreadType|null
Return values
MessageThreadType|nullisClosed()
public
isClosed() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisRepliableInSystem()
Can the thread be replied to directly in the system? (A guest thread offers contact details only.)
public
isRepliableInSystem() : bool
Return values
boolsetAccessToken()
public
setAccessToken(string|null $accessToken) : $this
Parameters
- $accessToken : string|null
Return values
$thissetAccessTokenValidUntil()
public
setAccessTokenValidUntil(DateTime|null $validUntil) : $this
Parameters
- $validUntil : DateTime|null
Return values
$thissetClosed()
public
setClosed(bool $closed) : $this
Parameters
- $closed : bool
Return values
$thissetDeleted()
public
setDeleted(bool $deleted) : $this
Parameters
- $deleted : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetLastMessageDatetime()
public
setLastMessageDatetime(DateTime|null $lastMessageDatetime) : $this
Parameters
- $lastMessageDatetime : DateTime|null
Return values
$thissetMessageCount()
public
setMessageCount(int $messageCount) : $this
Parameters
- $messageCount : int
Return values
$thissetReplyChannel()
public
setReplyChannel(MessageReplyChannel $replyChannel) : $this
Parameters
- $replyChannel : MessageReplyChannel
Return values
$thissetSubject()
public
setSubject(string|null $subject) : $this
Parameters
- $subject : string|null
Return values
$thissetType()
public
setType(MessageThreadType|null $type) : $this
Parameters
- $type : MessageThreadType|null
Return values
$thisgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>