CoolCMS API

MessageParticipant extends MessageParticipant
in package

Message participant (Api variant).

IMPORTANT: there is deliberately no thread association, even though includes: ['thread'] would simplify the "my messages" list. The ..._message_thread_id column is already owned by the scalar $threadId of the shared base, and Doctrine must not map it twice as writable. Reversing the ownership (association writes, scalar read-only, as in Response::$user) would force admin writes through ApiBridge to send a thin reference thread: {id} instead of threadId, which the hydrator supports only under certain conditions.

Threads are therefore loaded server-side by the dedicated action MessageThreadPresenter::internalActionMyThreads().

Attributes
#[Entity]
#[Table]
$name: 'cms_mod_base_message_participants'
#[TableAlias]
'messageParticipant'

Table of Contents

Constants

MAX_PER_THREAD  : int = 10
Maximum number of active participants in a thread (cap when a manager invites another).
MIN_ACTIVE_PER_THREAD  : int = 2
Minimum number of active participants: a thread has two sides at least, removal cannot go below that.

Properties

$archived  : bool
$deleted  : bool
"Deleted for me": the other side still sees the conversation (unlike `MessageThread::$deleted`).
$guestEmail  : string|null
$guestName  : string|null
$guestPhone  : string|null
$id  : int|null
$lastReadDatetime  : DateTime|null
$notify  : bool
Send an e-mail on a new message in the thread.
$removedDatetime  : DateTime|null
When a manager removed the participant from the thread (`NULL` = active). The row is not deleted: messages reference it via `participant_id ... ON DELETE SET NULL` and would turn into system messages. A removed participant does not see the thread (is not a member), but their messages stay signed with their name. Written only by the Api manager, never from outside.
$role  : MessageParticipantRole
$threadId  : int
$unreadCount  : int
$userId  : int|null

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getArchived()  : bool
getDeleted()  : bool
getGuestEmail()  : string|null
getGuestName()  : string|null
getGuestPhone()  : string|null
getId()  : int|null
getLastReadDatetime()  : DateTime|null
getNotify()  : bool
getRemovedDatetime()  : DateTime|null
getRole()  : MessageParticipantRole
getThreadId()  : int
getUnreadCount()  : int
getUserId()  : int|null
isArchived()  : bool
isDeleted()  : bool
isGuest()  : bool
Guest = participant without an account; the contact is in the `guest*` fields.
isNotify()  : bool
isPersisted()  : bool
isRemoved()  : bool
Removed by a manager: no longer a thread member.
setArchived()  : $this
setDeleted()  : $this
setGuestEmail()  : $this
setGuestName()  : $this
setGuestPhone()  : $this
setId()  : $this
setLastReadDatetime()  : $this
setNotify()  : $this
setRemovedDatetime()  : $this
setRole()  : $this
setThreadId()  : $this
setUnreadCount()  : $this
setUserId()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Constants

MAX_PER_THREAD

Maximum number of active participants in a thread (cap when a manager invites another).

public int MAX_PER_THREAD = 10

MIN_ACTIVE_PER_THREAD

Minimum number of active participants: a thread has two sides at least, removal cannot go below that.

public int MIN_ACTIVE_PER_THREAD = 2

Properties

$archived

protected bool $archived = false
Attributes
#[Column]
$name: 'archived'
$type: 'boolean'

$deleted

"Deleted for me": the other side still sees the conversation (unlike `MessageThread::$deleted`).

protected bool $deleted = false
Attributes
#[Column]
$name: 'deleted'
$type: 'boolean'
#[ExternalReadonly]

$guestEmail

protected string|null $guestEmail = null
Attributes
#[Column]
$name: 'guest_email'
$type: 'string'
$length: 255
$nullable: true

$guestName

protected string|null $guestName = null
Attributes
#[Column]
$name: 'guest_name'
$type: 'string'
$length: 100
$nullable: true

$guestPhone

protected string|null $guestPhone = null
Attributes
#[Column]
$name: 'guest_phone'
$type: 'string'
$length: 255
$nullable: true

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'message_participant_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$lastReadDatetime

protected DateTime|null $lastReadDatetime = null
Attributes
#[Column]
$name: 'last_read_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$notify

Send an e-mail on a new message in the thread.

protected bool $notify = true
Attributes
#[Column]
$name: 'notify'
$type: 'boolean'

$removedDatetime

When a manager removed the participant from the thread (`NULL` = active). The row is not deleted: messages reference it via `participant_id ... ON DELETE SET NULL` and would turn into system messages. A removed participant does not see the thread (is not a member), but their messages stay signed with their name. Written only by the Api manager, never from outside.

protected DateTime|null $removedDatetime = null
Attributes
#[Column]
$name: 'removed_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$threadId

protected int $threadId = 0
Attributes
#[Column]
$name: 'cms_mod_base_message_threads_message_thread_id'
$type: 'integer'
$options: ['unsigned' => true]

$userId

protected int|null $userId = null
Attributes
#[Column]
$name: 'cms_system_users_user_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, int $threadId = 0 ][, int|null $userId = null ][, MessageParticipantRole $role = MessageParticipantRole::Recipient ][, string|null $guestName = null ][, string|null $guestEmail = null ][, string|null $guestPhone = null ][, int $unreadCount = 0 ][, DateTime|null $lastReadDatetime = null ][, bool $notify = true ][, bool $archived = false ][, bool $deleted = false ][, DateTime|null $removedDatetime = null ]) : mixed
Parameters
$id : int|null = null
$threadId : int = 0
$userId : int|null = null
$role : MessageParticipantRole = MessageParticipantRole::Recipient
$guestName : string|null = null
$guestEmail : string|null = null
$guestPhone : string|null = null
$unreadCount : int = 0
$lastReadDatetime : DateTime|null = null
$notify : bool = true
$archived : bool = false
$deleted : bool = false
$removedDatetime : DateTime|null = null

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getAllTraits()

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>

getLastReadDatetime()

public getLastReadDatetime() : DateTime|null
Return values
DateTime|null

getRemovedDatetime()

public getRemovedDatetime() : DateTime|null
Return values
DateTime|null

isGuest()

Guest = participant without an account; the contact is in the `guest*` fields.

public isGuest() : bool
Return values
bool

isRemoved()

Removed by a manager: no longer a thread member.

public isRemoved() : bool
Return values
bool

setArchived()

public setArchived(bool $archived) : $this
Parameters
$archived : bool
Return values
$this

setDeleted()

public setDeleted(bool $deleted) : $this
Parameters
$deleted : bool
Return values
$this

setGuestEmail()

public setGuestEmail(string|null $guestEmail) : $this
Parameters
$guestEmail : string|null
Return values
$this

setGuestName()

public setGuestName(string|null $guestName) : $this
Parameters
$guestName : string|null
Return values
$this

setGuestPhone()

public setGuestPhone(string|null $guestPhone) : $this
Parameters
$guestPhone : string|null
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setLastReadDatetime()

public setLastReadDatetime(DateTime|null $lastReadDatetime) : $this
Parameters
$lastReadDatetime : DateTime|null
Return values
$this

setNotify()

public setNotify(bool $notify) : $this
Parameters
$notify : bool
Return values
$this

setRemovedDatetime()

public setRemovedDatetime(DateTime|null $removedDatetime) : $this
Parameters
$removedDatetime : DateTime|null
Return values
$this

setThreadId()

public setThreadId(int $threadId) : $this
Parameters
$threadId : int
Return values
$this

setUnreadCount()

public setUnreadCount(int $unreadCount) : $this
Parameters
$unreadCount : int
Return values
$this

setUserId()

public setUserId(int|null $userId) : $this
Parameters
$userId : int|null
Return values
$this

getTraitsRecursive()

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>
Return values
array<string, string>
On this page

Search results