CoolCMS API

GuestbookMessage extends BaseEntity
in package
implements ScopedTreeNodeInterface, OwnerAwareInterface, IdentifiableInterface uses IdentifiableTrait

AbstractYes

Legacy guestbook message (`cms_mod_blog_guestbook_messages`), kept for existing data.

New guestbook posts are comments of the central comment system (see Guestbook).

Messages form threads via parent_id plus nested set (lft/rgt/level), and one table holds several independent trees distinguished by the guestbook (cms_mod_blog_guestbooks_guestbook_id), hence ScopedTreeNodeInterface rather than plain TreeNodeInterface. Without the scoped marker the insert gate in SaveTrait skips the message, lft/rgt stay NULL and ordering threads by rgt returns an arbitrary order.

The scope is resolved through the ToOne association guestbook; the entity has no scalar guestbookId (the mapper also handles an FK join column, see TreeTrait::resolveTreeColumn()).

Tags
template
Attributes
#[MappedSuperclass]
#[PersonalDataOwner]
'userId'
#[TableAlias]
$alias: 'guestbook_message'

Table of Contents

Interfaces

ScopedTreeNodeInterface
Nested-set tree where one table holds several independent trees distinguished by a scope column (e.g. menu items distinguished by `menuId`). Extends {@see TreeNodeInterface} with a scope that the entity knows about itself.
OwnerAwareInterface
Entity that knows who created it (the owner is the author or sender of the record); the named entry point to the generic base of the conditional RBAC role `owner`.
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
$email  : string
$guestbook  : TGuestbook|int|string|null
$id  : int|null
$insertDatetime  : DateTime
$ip  : string
$languageId  : int|null
$level  : int
$lft  : int
$parentId  : int|null
$rgt  : int
$subject  : string|null
$text  : string
$userId  : int|null
$username  : string

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
getEmail()  : string
getGuestbook()  : TGuestbook|int|string|null
getId()  : int|null
getInsertDatetime()  : DateTime
getIp()  : string
getLanguageId()  : int|null
getLevel()  : int
getLft()  : int
getOwnerUserId()  : int|null
Returns the id of the user who created the record; `null` for an unknown or anonymous owner.
getParentId()  : int|null
getRgt()  : int
getSubject()  : string|null
getText()  : string
getTreeScope()  : array<string, scalar|null>
Returns the tree scope, which is the guestbook the message belongs to.
getUserId()  : int|null
getUsername()  : string
isDeleted()  : bool
isPersisted()  : bool
setDeleted()  : $this
setEmail()  : $this
setGuestbook()  : $this
setId()  : $this
setInsertDatetime()  : $this
setIp()  : $this
setLanguageId()  : $this
setLevel()  : $this
setLft()  : $this
setParentId()  : $this
setRgt()  : $this
setSubject()  : $this
setText()  : $this
setUserId()  : $this
setUsername()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$email

protected string $email = ''
Attributes
#[Column]
$type: 'string'
$name: 'email'
$length: 255
#[PersonalData]
PersonalDataKind::Email

$guestbook

protected TGuestbook|int|string|null $guestbook = null

guestbook object, or the plain id on a hand-built entity

Attributes
#[Transient]

$id

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

$languageId

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

$level

protected int $level = 1
Attributes
#[Column]
$type: 'integer'
$name: 'level'

$lft

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

$parentId

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

$rgt

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

$subject

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

$text

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

$userId

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

$username

protected string $username = ''
Attributes
#[Column]
$type: 'string'
$name: 'username'
$length: 50

Methods

__construct()

public __construct([int|null $id = null ][, mixed $guestbook = null ][, int|null $userId = null ][, int|null $languageId = null ][, string $username = '' ][, string $email = '' ][, string|null $subject = null ][, string $text = '' ][, string $ip = '' ][, DateTime $insertDatetime = new DateTime() ][, bool $deleted = false ][, int $lft = 0 ][, int $rgt = 0 ][, int|null $parentId = null ][, int $level = 1 ]) : mixed
Parameters
$id : int|null = null
$guestbook : mixed = null
$userId : int|null = null
$languageId : int|null = null
$username : string = ''
$email : string = ''
$subject : string|null = null
$text : string = ''
$ip : string = ''
$insertDatetime : DateTime = new DateTime()
$deleted : bool = false
$lft : int = 0
$rgt : int = 0
$parentId : int|null = null
$level : int = 1

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>

getGuestbook()

public getGuestbook() : TGuestbook|int|string|null
Return values
TGuestbook|int|string|null

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getLanguageId()

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

getOwnerUserId()

Returns the id of the user who created the record; `null` for an unknown or anonymous owner.

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

getSubject()

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

getTreeScope()

Returns the tree scope, which is the guestbook the message belongs to.

public getTreeScope() : array<string, scalar|null>

The key is the property guestbook (ToOne association); the mapper resolves it to the FK column cms_mod_blog_guestbooks_guestbook_id through Doctrine metadata. Without the scope, lft/rgt would be computed across all guestbooks together.

The value is read tolerantly: $guestbook holds either the guestbook entity (Api/Front map the association) or, on a hand-built entity, the plain id.

Return values
array<string, scalar|null>

setDeleted()

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

setEmail()

public setEmail(string $email) : $this
Parameters
$email : string
Return values
$this

setGuestbook()

public setGuestbook(TGuestbook|int|string|null $guestbook) : $this
Parameters
$guestbook : TGuestbook|int|string|null
Return values
$this

setId()

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

setInsertDatetime()

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

setIp()

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

setLanguageId()

public setLanguageId(int|null $languageId) : $this
Parameters
$languageId : int|null
Return values
$this

setLevel()

public setLevel(int $level) : $this
Parameters
$level : int
Return values
$this

setLft()

public setLft(int $lft) : $this
Parameters
$lft : int
Return values
$this

setParentId()

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

setRgt()

public setRgt(int $rgt) : $this
Parameters
$rgt : int
Return values
$this

setSubject()

public setSubject(string|null $subject) : $this
Parameters
$subject : string|null
Return values
$this

setText()

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

setUserId()

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

setUsername()

public setUsername(string $username) : $this
Parameters
$username : string
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