CoolCMS API

Message extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

One message in a private conversation.

IMPORTANT: the sender is a reference to a participant ($participantId), not a userId plus a name on the message; otherwise the sender identity would live in two tables and drift apart. null means a system message.

Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'message'

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

$deleted  : bool
$id  : int|null
$insertDatetime  : DateTime
$ip  : string|null
$parentId  : int|null
$participantId  : int|null
$text  : string
User input; sanitized on output like comments and discussion.
$threadId  : int

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.
getDeleted()  : bool
getId()  : int|null
getInsertDatetime()  : DateTime
getIp()  : string|null
getParentId()  : int|null
getParticipantId()  : int|null
getText()  : string
getThreadId()  : int
isDeleted()  : bool
isPersisted()  : bool
isSystem()  : bool
System message (no sender), e.g. an advert was deleted.
setDeleted()  : $this
setId()  : $this
setInsertDatetime()  : $this
setIp()  : $this
setParentId()  : $this
setParticipantId()  : $this
setText()  : $this
setThreadId()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$id

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

$insertDatetime

protected DateTime $insertDatetime = new DateTime()
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$parentId

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

$participantId

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

$text

User input; sanitized on output like comments and discussion.

protected string $text = ''
Attributes
#[Column]
$name: 'text'
$type: 'text'

$threadId

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

Methods

__construct()

public __construct([int|null $id = null ][, int $threadId = 0 ][, int|null $participantId = null ][, int|null $parentId = null ][, string $text = '' ][, string|null $ip = null ][, DateTime $insertDatetime = new DateTime() ][, bool $deleted = false ]) : mixed
Parameters
$id : int|null = null
$threadId : int = 0
$participantId : int|null = null
$parentId : int|null = null
$text : string = ''
$ip : string|null = null
$insertDatetime : DateTime = new DateTime()
$deleted : bool = false

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>

getDeleted()

public getDeleted() : bool
Return values
bool

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getIp()

public getIp() : string|null
Return values
string|null

getParentId()

public getParentId() : int|null
Return values
int|null

getParticipantId()

public getParticipantId() : int|null
Return values
int|null

getText()

public getText() : string
Return values
string

getThreadId()

public getThreadId() : int
Return values
int

isDeleted()

public isDeleted() : bool
Return values
bool

isSystem()

System message (no sender), e.g. an advert was deleted.

public isSystem() : bool
Return values
bool

setDeleted()

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

setId()

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

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setIp()

public setIp(string|null $ip) : $this
Parameters
$ip : string|null
Return values
$this

setParentId()

public setParentId(int|null $parentId) : $this
Parameters
$parentId : int|null
Return values
$this

setParticipantId()

public setParticipantId(int|null $participantId) : $this
Parameters
$participantId : int|null
Return values
$this

setText()

public setText(string $text) : $this
Parameters
$text : string
Return values
$this

setThreadId()

public setThreadId(int $threadId) : $this
Parameters
$threadId : int
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