CoolCMS API

NotificationType extends NotificationType
in package

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_system_notification_types'
#[TableAlias]
'notificationType'

Table of Contents

Properties

$active  : bool
$adminPageId  : int|null
Admin page (`cms_admin_system_pages`) the notification of this type links to. Its `presenter` + `action` form the destination, completed with `['id' => notification.itemId]` (NOTE: the notification `id` column, not `notification_id`).
$icon  : string|null
Font Awesome icon class of the type (`fa-solid fa-cart-shopping`). The class is stored; the template just puts it into `<i class="...">`. `null` = the placeholder icon is used ({@see \App\UI\Admin\System\Components\NotificationBellComponent\NotificationBell}).
$id  : int|null
$key  : string
$moduleId  : int
$translations  : Collection

Methods

__construct()  : mixed
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActive()  : bool
getAdminPageId()  : int|null
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getIcon()  : string|null
getId()  : int|null
getKey()  : string
getModuleId()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
isActive()  : bool
isPersisted()  : bool
removeTranslation()  : $this
setActive()  : $this
setAdminPageId()  : $this
setIcon()  : $this
setId()  : $this
setKey()  : $this
setModuleId()  : $this
setTranslations()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

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

$adminPageId

Admin page (`cms_admin_system_pages`) the notification of this type links to. Its `presenter` + `action` form the destination, completed with `['id' => notification.itemId]` (NOTE: the notification `id` column, not `notification_id`).

protected int|null $adminPageId = null

null = the type has nowhere to link. Without this column a type added in the admin would silently have no link.

Attributes
#[Column]
$name: 'cms_admin_system_pages_page_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$icon

Font Awesome icon class of the type (`fa-solid fa-cart-shopping`). The class is stored; the template just puts it into `<i class="...">`. `null` = the placeholder icon is used ({@see \App\UI\Admin\System\Components\NotificationBellComponent\NotificationBell}).

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

$id

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

$key

protected string $key = ''
Attributes
#[Column]
$name: '`key`'
$type: 'string'
$length: 25

$moduleId

protected int $moduleId = 1
Attributes
#[Column]
$name: 'module_id'
$type: 'smallint'
$options: ['unsigned' => true]

$translations

protected Collection $translations
Attributes
#[OneToMany]
$targetEntity: \App\UI\Api\System\Models\Entities\NotificationTypeText::class
$mappedBy: 'parent'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

Methods

__construct()

public __construct([int|null $id = null ][, int $moduleId = 1 ][, string $key = '' ][, int|null $adminPageId = null ][, string|null $icon = null ][, bool $active = false ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$moduleId : int = 1
$key : string = ''
$adminPageId : int|null = null
$icon : string|null = null
$active : bool = false
$translations : Collection = new ArrayCollection()

addTranslation()

public addTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

callInitMethods()

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

public callInitMethods() : void

getAdminPageId()

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

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>

getTranslation()

public getTranslation(int $langId) : TTranslation|null
Parameters
$langId : int
Return values
TTranslation|null

getTranslations()

public getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setActive()

public setActive(bool $active) : $this
Parameters
$active : bool
Return values
$this

setAdminPageId()

public setAdminPageId(int|null $adminPageId) : $this
Parameters
$adminPageId : int|null
Return values
$this

setIcon()

public setIcon(string|null $icon) : $this
Parameters
$icon : string|null
Return values
$this

setId()

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

setKey()

public setKey(string $key) : $this
Parameters
$key : string
Return values
$this

setModuleId()

public setModuleId(int $moduleId) : $this
Parameters
$moduleId : int
Return values
$this

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
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