CoolCMS API

MenuItem extends MenuItem
in package

A menu item is a nested-set tree (lft/rgt/level + parentId); several roots live in one table, told apart by `menuId`. {@see ScopedTreeNodeInterface} is the gate by which the generic `save()` ({@see \App\Core\Traits\Api\Models\Managers\SaveTrait}) recognizes that a newly inserted item needs lft/rgt/level computed (`insertTreeNode`), and it supplies the scope (`menuId`) via {@see getTreeScope()}, so indexes are computed within one menu only, without overriding `treeConfigForEntity()` in the manager.

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_system_menu_items'
#[TableAlias]
'menuItem'

Table of Contents

Properties

$active  : bool
$attributeId  : string|null
$blank  : bool
$class  : string|null
$extension  : string|null
$forLogged  : bool
$forUnlogged  : bool
$iconClass  : string|null
$id  : int|null
$level  : int
$lft  : int
$link  : string|null
$menu  : Menu|null
$menuId  : int
$page  : TPage|null
$pageId  : int|null
$parameters  : string|null
$parentId  : int|null
$rgt  : int
$translations  : Collection

Methods

__construct()  : mixed
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActive()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getAttributeClass()  : string|null
getAttributeId()  : string|null
getBlank()  : bool
getClass()  : string|null
getExtension()  : string|null
getForLogged()  : bool
getForUnlogged()  : bool
getIconClass()  : string|null
getId()  : int|null
getLevel()  : int
getLft()  : int
getLink()  : string|null
getMenuId()  : int
getPage()  : TPage|null
getPageId()  : int|null
getParameters()  : string|null
getParentId()  : int|null
getRgt()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getTreeScope()  : array<string, scalar|null>
Nested-set tree scope: items are numbered separately per menu.
isActive()  : bool
isBlank()  : bool
isForLogged()  : bool
isForUnlogged()  : bool
isPersisted()  : bool
removeTranslation()  : $this
setActive()  : $this
setAttributeClass()  : self
setAttributeId()  : $this
setBlank()  : $this
setClass()  : $this
setExtension()  : $this
setForLogged()  : $this
setForUnlogged()  : $this
setIconClass()  : $this
setId()  : $this
setLevel()  : $this
setLft()  : $this
setLink()  : $this
setMenuId()  : $this
setPage()  : $this
setPageId()  : $this
setParameters()  : $this
setParentId()  : $this
setRgt()  : $this
setTranslations()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

protected bool $active = true
Attributes
#[Column]
$name: 'active'
$type: 'boolean'

$attributeId

protected string|null $attributeId = null
Attributes
#[Column]
$name: 'id'
$type: 'string'
$length: 45
$nullable: true

$blank

protected bool $blank = false
Attributes
#[Column]
$name: 'blank'
$type: 'boolean'

$class

protected string|null $class = null
Attributes
#[Column]
$name: 'class'
$type: 'string'
$length: 45
$nullable: true

$extension

protected string|null $extension = null
Attributes
#[Column]
$name: 'extension'
$type: 'string'
$length: 255
$nullable: true

$forLogged

protected bool $forLogged = true
Attributes
#[Column]
$name: 'for_logged'
$type: 'boolean'

$forUnlogged

protected bool $forUnlogged = true
Attributes
#[Column]
$name: 'for_unlogged'
$type: 'boolean'

$iconClass

protected string|null $iconClass = null
Attributes
#[Column]
$name: 'icon_class'
$type: 'string'
$length: 50
$nullable: true

$id

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

$level

protected int $level = 0
Attributes
#[Column]
$name: 'level'
$type: 'integer'
$options: ['unsigned' => true]

$lft

protected int $lft = 0
Attributes
#[Column]
$name: 'lft'
$type: 'integer'
$options: ['unsigned' => true]
protected string|null $link = null
#[Column]
$name: 'link'
$type: 'string'
$length: 255
$nullable: true

$menu

protected Menu|null $menu
Attributes
#[EntityOf]
\App\UI\Front\System\Models\Entities\Menu::class
#[JoinColumn]
$name: 'cms_system_menu_menu_id'
$referencedColumnName: 'menu_id'
$nullable: false
#[ManyToOne]
$targetEntity: \App\UI\Front\System\Models\Entities\Menu::class
$inversedBy: 'items'
#[ParentRef]

$menuId

protected int $menuId = 0
Attributes
#[Column]
$name: 'cms_system_menu_menu_id'
$type: 'integer'
$options: ['unsigned' => true]

$page

protected TPage|null $page = null
Attributes
#[EntityOf]
\App\UI\Front\System\Models\Entities\Page::class
#[JoinColumn]
$name: 'cms_system_pages_page_id'
$referencedColumnName: 'page_id'
$nullable: true
#[ManyToOne]
$targetEntity: \App\UI\Front\System\Models\Entities\Page::class
$fetch: "LAZY"

$pageId

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

$parameters

protected string|null $parameters = null
Attributes
#[Column]
$name: 'parameters'
$type: 'string'
$length: 255
$nullable: true

$parentId

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

$rgt

protected int $rgt = 0
Attributes
#[Column]
$name: 'rgt'
$type: 'integer'
$options: ['unsigned' => true]

$translations

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

Methods

__construct()

public __construct([int|null $id = null ][, int|null $pageId = null ][, mixed $page = null ][, int $menuId = 0 ][, int|null $parentId = null ][, int $lft = 0 ][, int $rgt = 0 ][, int $level = 0 ][, string|null $class = null ][, string|null $iconClass = null ][, string|null $attributeId = null ][, string|null $link = null ][, string|null $extension = null ][, string|null $parameters = null ][, bool $active = true ][, bool $blank = false ][, bool $forLogged = true ][, bool $forUnlogged = true ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$pageId : int|null = null
$page : mixed = null
$menuId : int = 0
$parentId : int|null = null
$lft : int = 0
$rgt : int = 0
$level : int = 0
$class : string|null = null
$iconClass : string|null = null
$attributeId : string|null = null
$link : string|null = null
$extension : string|null = null
$parameters : string|null = null
$active : bool = true
$blank : bool = false
$forLogged : bool = true
$forUnlogged : bool = true
$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

getActive()

public getActive() : bool
Return values
bool

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>

getAttributeClass()

public getAttributeClass() : string|null
Return values
string|null

getAttributeId()

public getAttributeId() : string|null
Return values
string|null

getBlank()

public getBlank() : bool
Return values
bool

getClass()

public getClass() : string|null
Return values
string|null

getExtension()

public getExtension() : string|null
Return values
string|null

getForLogged()

public getForLogged() : bool
Return values
bool

getForUnlogged()

public getForUnlogged() : bool
Return values
bool

getIconClass()

public getIconClass() : string|null
Return values
string|null

getLevel()

public getLevel() : int
Return values
int

getLft()

public getLft() : int
Return values
int
public getLink() : string|null
Return values
string|null

getMenuId()

public getMenuId() : int
Return values
int

getPage()

public getPage() : TPage|null
Return values
TPage|null

getPageId()

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

getParameters()

public getParameters() : string|null
Return values
string|null

getParentId()

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

getRgt()

public getRgt() : int
Return values
int

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>

getTreeScope()

Nested-set tree scope: items are numbered separately per menu.

public getTreeScope() : array<string, scalar|null>
Return values
array<string, scalar|null>

isActive()

public isActive() : bool
Return values
bool

isBlank()

public isBlank() : bool
Return values
bool

isForLogged()

public isForLogged() : bool
Return values
bool

isForUnlogged()

public isForUnlogged() : bool
Return values
bool

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setActive()

public setActive(bool $active) : $this
Parameters
$active : bool
Return values
$this

setAttributeClass()

public setAttributeClass(string|null $class) : self
Parameters
$class : string|null
Return values
self

setAttributeId()

public setAttributeId(string|null $attributeId) : $this
Parameters
$attributeId : string|null
Return values
$this

setBlank()

public setBlank(bool $blank) : $this
Parameters
$blank : bool
Return values
$this

setClass()

public setClass(string|null $class) : $this
Parameters
$class : string|null
Return values
$this

setExtension()

public setExtension(string|null $extension) : $this
Parameters
$extension : string|null
Return values
$this

setForLogged()

public setForLogged(bool $forLogged) : $this
Parameters
$forLogged : bool
Return values
$this

setForUnlogged()

public setForUnlogged(bool $forUnlogged) : $this
Parameters
$forUnlogged : bool
Return values
$this

setIconClass()

public setIconClass(string|null $iconClass) : $this
Parameters
$iconClass : string|null
Return values
$this

setId()

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

setLevel()

public setLevel(int $level) : $this
Parameters
$level : int
Return values
$this

setLft()

public setLft(int $lft) : $this
Parameters
$lft : int
Return values
$this
public setLink(string|null $link) : $this
Parameters
$link : string|null
Return values
$this

setMenuId()

public setMenuId(int $menuId) : $this
Parameters
$menuId : int
Return values
$this

setPage()

public setPage(TPage|null $page) : $this
Parameters
$page : TPage|null
Return values
$this

setPageId()

public setPageId(int|null $pageId) : $this
Parameters
$pageId : int|null
Return values
$this

setParameters()

public setParameters(string|null $parameters) : $this
Parameters
$parameters : string|null
Return values
$this

setParentId()

public setParentId(int|null $parentId) : $this
Parameters
$parentId : int|null
Return values
$this

setRgt()

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