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'
$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
$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
$role
protected
MessageParticipantRole
$role
= MessageParticipantRole::Recipient
Attributes
- #[Column]
- $name: 'role'
- $type: 'string'
- $length: 16
- $enumType: MessageParticipantRole::class
$threadId
protected
int
$threadId
= 0
Attributes
- #[Column]
- $name: 'cms_mod_base_message_threads_message_thread_id'
- $type: 'integer'
- $options: ['unsigned' => true]
$unreadCount
protected
int
$unreadCount
= 0
Attributes
- #[Column]
- $name: 'unread_count'
- $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]
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>getArchived()
public
getArchived() : bool
Return values
boolgetDeleted()
public
getDeleted() : bool
Return values
boolgetGuestEmail()
public
getGuestEmail() : string|null
Return values
string|nullgetGuestName()
public
getGuestName() : string|null
Return values
string|nullgetGuestPhone()
public
getGuestPhone() : string|null
Return values
string|nullgetId()
public
getId() : int|null
Return values
int|nullgetLastReadDatetime()
public
getLastReadDatetime() : DateTime|null
Return values
DateTime|nullgetNotify()
public
getNotify() : bool
Return values
boolgetRemovedDatetime()
public
getRemovedDatetime() : DateTime|null
Return values
DateTime|nullgetRole()
public
getRole() : MessageParticipantRole
Return values
MessageParticipantRolegetThreadId()
public
getThreadId() : int
Return values
intgetUnreadCount()
public
getUnreadCount() : int
Return values
intgetUserId()
public
getUserId() : int|null
Return values
int|nullisArchived()
public
isArchived() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisGuest()
Guest = participant without an account; the contact is in the `guest*` fields.
public
isGuest() : bool
Return values
boolisNotify()
public
isNotify() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisRemoved()
Removed by a manager: no longer a thread member.
public
isRemoved() : bool
Return values
boolsetArchived()
public
setArchived(bool $archived) : $this
Parameters
- $archived : bool
Return values
$thissetDeleted()
public
setDeleted(bool $deleted) : $this
Parameters
- $deleted : bool
Return values
$thissetGuestEmail()
public
setGuestEmail(string|null $guestEmail) : $this
Parameters
- $guestEmail : string|null
Return values
$thissetGuestName()
public
setGuestName(string|null $guestName) : $this
Parameters
- $guestName : string|null
Return values
$thissetGuestPhone()
public
setGuestPhone(string|null $guestPhone) : $this
Parameters
- $guestPhone : string|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetLastReadDatetime()
public
setLastReadDatetime(DateTime|null $lastReadDatetime) : $this
Parameters
- $lastReadDatetime : DateTime|null
Return values
$thissetNotify()
public
setNotify(bool $notify) : $this
Parameters
- $notify : bool
Return values
$thissetRemovedDatetime()
public
setRemovedDatetime(DateTime|null $removedDatetime) : $this
Parameters
- $removedDatetime : DateTime|null
Return values
$thissetRole()
public
setRole(MessageParticipantRole $role) : $this
Parameters
- $role : MessageParticipantRole
Return values
$thissetThreadId()
public
setThreadId(int $threadId) : $this
Parameters
- $threadId : int
Return values
$thissetUnreadCount()
public
setUnreadCount(int $unreadCount) : $this
Parameters
- $unreadCount : int
Return values
$thissetUserId()
public
setUserId(int|null $userId) : $this
Parameters
- $userId : int|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>