CoolCMS API

UserRolePrivilege extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait, TranslationCollectionTrait

AbstractYes
Tags
template
Attributes
#[MappedSuperclass]

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

$branch  : string
Root branch of the key (`:Admin` / `:Front` / `:Api`). Badge and filter in the admin; existing keys keep `Admin` (the default).
$id  : int|null
$key  : string|null
$privilegeGroupId  : int|null
Functional group: purely presentational, not an authorization node. `null` means "unassigned"; the privilege is enforced the same way anyway.
$sort  : int
Order within the group (Multiplier).
$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.
getBranch()  : string
getId()  : int|null
getKey()  : string|null
getPrivilegeGroupId()  : int|null
getSort()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
isPersisted()  : bool
removeTranslation()  : $this
setBranch()  : $this
setId()  : $this
setKey()  : $this
setPrivilegeGroupId()  : $this
setSort()  : $this
setTranslations()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$branch

Root branch of the key (`:Admin` / `:Front` / `:Api`). Badge and filter in the admin; existing keys keep `Admin` (the default).

protected string $branch = 'Admin'
Attributes
#[Column]
$type: "string"
$length: 10

$id

protected int|null $id = null
Attributes
#[Column]
$type: "integer"
$name: "user_role_privilege_id"
#[GeneratedValue]
#[Id]

$key

protected string|null $key = null
Attributes
#[Column]
$type: "string"
$length: 255
$name: "`key`"
$nullable: true

$privilegeGroupId

Functional group: purely presentational, not an authorization node. `null` means "unassigned"; the privilege is enforced the same way anyway.

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

$sort

Order within the group (Multiplier).

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

$translations

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

Methods

__construct()

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

getPrivilegeGroupId()

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

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

setBranch()

public setBranch(string $branch) : $this
Parameters
$branch : string
Return values
$this

setId()

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

setKey()

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

setPrivilegeGroupId()

public setPrivilegeGroupId(int|null $privilegeGroupId) : $this
Parameters
$privilegeGroupId : int|null
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