CoolCMS API

PrivilegeGroup extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait, TranslationCollectionTrait

AbstractYes

Functional group of privileges (`cms_system_privilege_groups`): a purely presentational grouping across the `:Admin` / `:Front` / `:Api` branches.

IMPORTANT: it is not an authorization node. It has no allowed, no role relations and must never appear in the evaluation query; it is only a named bucket with a label and the carrier of the edit screen (Multiplier).

key has no leading colon (Eshop:Order:show); that is the only distinction between a group and a privilege: what starts with : is enforced, what does not is only a label.

Tags
template
Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'privilegeGroup'

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

$entity  : string
$family  : string
`show`, `save`, `delete` or a standalone action name.
$id  : int|null
$key  : string
`<Module>:<Entity>:<family>`, e.g. `Eshop:Order:show`, without a leading colon.
$module  : string
$sort  : int
$translations  : Collection<int, TTranslation>

Methods

__construct()  : mixed
addTranslation()  : $this
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.
getEntity()  : string
getFamily()  : string
getId()  : int|null
getKey()  : string
getModule()  : string
getSort()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
isPersisted()  : bool
removeTranslation()  : $this
setEntity()  : $this
setFamily()  : $this
setId()  : $this
setKey()  : $this
setModule()  : $this
setSort()  : $this
setTranslations()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$entity

protected string $entity = ''
Attributes
#[Column]
$name: 'entity'
$type: 'string'
$length: 100

$family

`show`, `save`, `delete` or a standalone action name.

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

$id

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

$key

`<Module>:<Entity>:<family>`, e.g. `Eshop:Order:show`, without a leading colon.

protected string $key = ''

IMPORTANT: key is a reserved sql word. Without a backtick-quoted name Doctrine generates insert into … (key, …) and MariaDB rejects it (SyntaxErrorException #1064).

Attributes
#[Column]
$name: '`key`'
$type: 'string'
$length: 255

$module

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

$sort

protected int $sort = 0
Attributes
#[Column]
$name: 'sort'
$type: 'integer'

$translations

protected Collection<int, TTranslation> $translations = new ArrayCollection()

Methods

__construct()

public __construct([int|null $id = null ][, string $key = '' ][, string $module = '' ][, string $entity = '' ][, string $family = '' ][, int $sort = 0 ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$key : string = ''
$module : string = ''
$entity : string = ''
$family : string = ''
$sort : int = 0
$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

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

setEntity()

public setEntity(string $entity) : $this
Parameters
$entity : string
Return values
$this

setFamily()

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

setModule()

public setModule(string $module) : $this
Parameters
$module : string
Return values
$this

setSort()

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