UserPrivilege
extends UserRolePrivilege
in package
The leaf does not map `translations` (no `UserPrivilegeText`); the translation collection stays untyped.
Tags
Attributes
- #[Entity]
Table of Contents
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>
- $userRoles : Collection<int, UserRole>
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()
$userRoles
protected
Collection<int, UserRole>
$userRoles
Attributes
- #[CollectionOf]
- \App\UI\Front\System\Models\Entities\UserRole::class
- #[ManyToMany]
- $targetEntity: \App\UI\Front\System\Models\Entities\UserRole::class
- $mappedBy: "privileges"
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
$thiscallInitMethods()
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>getBranch()
public
getBranch() : string
Return values
stringgetId()
public
getId() : int|null
Return values
int|nullgetKey()
public
getKey() : string|null
Return values
string|nullgetPrivilegeGroupId()
public
getPrivilegeGroupId() : int|null
Return values
int|nullgetSort()
public
getSort() : 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>isPersisted()
public
isPersisted() : bool
Return values
boolremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetBranch()
public
setBranch(string $branch) : $this
Parameters
- $branch : string
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetKey()
public
setKey(string|null $key) : $this
Parameters
- $key : string|null
Return values
$thissetPrivilegeGroupId()
public
setPrivilegeGroupId(int|null $privilegeGroupId) : $this
Parameters
- $privilegeGroupId : int|null
Return values
$thissetSort()
public
setSort(int $sort) : $this
Parameters
- $sort : 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>