CoolCMS API

UserRolePrivilege extends UserRolePrivilege
in package

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_system_user_role_privileges'
#[TableAlias]
'userRolePrivilege'

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).
$groupKey  : string|null
Group key shown in the list; not a column. `UserRolePrivilegeGridService` fills it from the join in Api `findPrivileges()`.
$id  : int|null
$key  : string|null
$name  : string|null
Privilege name in the current admin language; not a column, the ORM `translations` collection is not loaded here (raw SQL path). `UserRolePrivilegeGridService` fills it from `UserRolePrivilegeMatrixManager::namesForPrivileges()` (left join of `cms_system_user_role_privilege_texts` with fallback to the default language).
$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
Privilege labels.
$userRoleRels  : Collection<int, UserRolePrivilegeRel>
Role links (RBAC matrix): the cell of a list row. Filled set-based by {@see \App\UI\Admin\System\Models\Helpers\UserRolePrivilegeGridService}, not by Doctrine one-to-many (the join table has a derived identity, which the ORM deliberately avoids).

Methods

__construct()  : mixed
addTranslation()  : $this
addUserRoleRel()  : self
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
clearUserRoleRels()  : self
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getBranch()  : string
getGroupKey()  : string|null
getId()  : int|null
getKey()  : string|null
getName()  : string|null
getPrivilegeGroupId()  : int|null
getSort()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getUserRoleRels()  : Collection<int, UserRolePrivilegeRel>
isPersisted()  : bool
removeTranslation()  : $this
setBranch()  : $this
setGroupKey()  : self
setId()  : $this
setKey()  : $this
setName()  : self
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

$groupKey

Group key shown in the list; not a column. `UserRolePrivilegeGridService` fills it from the join in Api `findPrivileges()`.

protected string|null $groupKey = null
Attributes
#[Transient]

$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

$name

Privilege name in the current admin language; not a column, the ORM `translations` collection is not loaded here (raw SQL path). `UserRolePrivilegeGridService` fills it from `UserRolePrivilegeMatrixManager::namesForPrivileges()` (left join of `cms_system_user_role_privilege_texts` with fallback to the default language).

protected string|null $name = null

Read-only in the grid; names have no CRUD here (see UserRolePrivilegeText).

Attributes
#[Transient]

$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

Privilege labels.

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

$userRoleRels

Role links (RBAC matrix): the cell of a list row. Filled set-based by {@see \App\UI\Admin\System\Models\Helpers\UserRolePrivilegeGridService}, not by Doctrine one-to-many (the join table has a derived identity, which the ORM deliberately avoids).

protected Collection<int, UserRolePrivilegeRel> $userRoleRels

The DataGrid reads it via RelationColumn.

Attributes
#[CollectionOf]
\App\UI\Admin\System\Models\Entities\UserRolePrivilegeRel::class

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

setGroupKey()

public setGroupKey(string|null $groupKey) : self
Parameters
$groupKey : string|null
Return values
self

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

setName()

public setName(string|null $name) : self
Parameters
$name : string|null
Return values
self

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