NotificationType
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait, TranslationCollectionTrait
Tags
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'notificationType'
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
- $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<int, TTranslation>
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<int, TTranslation>
$translations
= new ArrayCollection()
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
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getActive()
public
getActive() : bool
Return values
boolgetAdminPageId()
public
getAdminPageId() : int|null
Return values
int|nullgetAllTraits()
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>getIcon()
public
getIcon() : string|null
Return values
string|nullgetId()
public
getId() : int|null
Return values
int|nullgetKey()
public
getKey() : string
Return values
stringgetModuleId()
public
getModuleId() : int
Return values
intgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>isActive()
public
isActive() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thissetAdminPageId()
public
setAdminPageId(int|null $adminPageId) : $this
Parameters
- $adminPageId : int|null
Return values
$thissetIcon()
public
setIcon(string|null $icon) : $this
Parameters
- $icon : string|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetKey()
public
setKey(string $key) : $this
Parameters
- $key : string
Return values
$thissetModuleId()
public
setModuleId(int $moduleId) : $this
Parameters
- $moduleId : int
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thistranslationCollectionInit()
public
translationCollectionInit() : void
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>