NodeRepository
Table of Contents
Constants
- NODE_CACHE_KEY = 'structure/node/%d'
- NODE_ENTITY_CACHE_KEY = 'structure/node/entity/%d'
- NODE_ENTITY_RESTRICTION_CACHE = 'structure/node/restriction'
Methods
- create() : Node
- deleteById() : void
- Delete a node and all associated data from the database.
- findAllByAccessCodes() : NodeCollection
- findAllByIds() : NodeCollection
- findAllByUserId() : NodeCollection
- findAllByUserIdAndRoleId() : NodeCollection
- findAllByXmlId() : NodeCollection
- getAllByStructureId() : NodeCollection
- getAllChildIdsByNodeId() : array<int, int>
- Retrieves all child ids of a given node id.
- getAllPagedByStructureId() : NodeCollection
- getByAccessCode() : Node|null
- Retrieve a node by access code.
- getById() : Node|null
- getByIdWithDepth() : Node|null
- returns node data with depth level
- getChildOf() : NodeCollection
- getChildOfNodeCollection() : NodeCollection
- getNodesByName() : NodeCollection
- getParentOf() : NodeCollection
- getRootNodeByStructureId() : Node|null
- Retrieves the root node by structure id.
- hasChild() : bool
- isAncestor() : bool
- update() : Node
Constants
NODE_CACHE_KEY
public
mixed
NODE_CACHE_KEY
= 'structure/node/%d'
NODE_ENTITY_CACHE_KEY
public
mixed
NODE_ENTITY_CACHE_KEY
= 'structure/node/entity/%d'
NODE_ENTITY_RESTRICTION_CACHE
public
mixed
NODE_ENTITY_RESTRICTION_CACHE
= 'structure/node/restriction'
Methods
create()
public
create(Node $node) : Node
Parameters
- $node : Node
Tags
Return values
NodedeleteById()
Delete a node and all associated data from the database.
public
deleteById(int $nodeId) : void
Parameters
- $nodeId : int
Tags
findAllByAccessCodes()
public
findAllByAccessCodes(array<int, int> $departments) : NodeCollection
Parameters
- $departments : array<int, int>
Tags
Return values
NodeCollectionfindAllByIds()
public
findAllByIds(array<string|int, mixed> $departmentIds[, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $departmentIds : array<string|int, mixed>
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Tags
Return values
NodeCollectionfindAllByUserId()
public
findAllByUserId(int $userId[, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $userId : int
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Return values
NodeCollectionfindAllByUserIdAndRoleId()
public
findAllByUserIdAndRoleId(int $userId, int $roleId[, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $userId : int
- $roleId : int
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Return values
NodeCollectionfindAllByXmlId()
public
findAllByXmlId(string $xmlId[, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $xmlId : string
-
The XML ID of the nodes to find
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Tags
Return values
NodeCollection —The collection of nodes found
getAllByStructureId()
public
getAllByStructureId(int $structureId[, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $structureId : int
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Tags
Return values
NodeCollectiongetAllChildIdsByNodeId()
Retrieves all child ids of a given node id.
public
getAllChildIdsByNodeId(int $nodeId) : array<int, int>
Parameters
- $nodeId : int
Return values
array<int, int>getAllPagedByStructureId()
public
getAllPagedByStructureId(int $structureId[, int $limit = 10 ][, int $offset = 0 ][, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $structureId : int
- $limit : int = 10
- $offset : int = 0
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Return values
NodeCollectiongetByAccessCode()
Retrieve a node by access code.
public
getByAccessCode(string $accessCode) : Node|null
Parameters
- $accessCode : string
-
The access code of the node.
Tags
Return values
Node|null —The node with the given access code, or null if not found.
getById()
public
getById(int $nodeId[, bool $needDepth = false ]) : Node|null
Parameters
- $nodeId : int
- $needDepth : bool = false
Tags
Return values
Node|nullgetByIdWithDepth()
returns node data with depth level
public
getByIdWithDepth(int $nodeId) : Node|null
Parameters
- $nodeId : int
Tags
Return values
Node|nullgetChildOf()
public
getChildOf(Node $node[, DepthLevel|int $depthLevel = DepthLevel::FIRST ][, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $node : Node
- $depthLevel : DepthLevel|int = DepthLevel::FIRST
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Return values
NodeCollectiongetChildOfNodeCollection()
public
getChildOfNodeCollection(NodeCollection $nodeCollection[, DepthLevel|int $depthLevel = DepthLevel::FIRST ][, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $nodeCollection : NodeCollection
- $depthLevel : DepthLevel|int = DepthLevel::FIRST
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Return values
NodeCollectiongetNodesByName()
public
getNodesByName(int $structureId, string|null $name[, int|null $limit = 100 ][, int|null $parentId = null ][, DepthLevel|int $depth = DepthLevel::FULL ][, bool $strict = false ][, NodeActiveFilter $activeFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE ]) : NodeCollection
Parameters
- $structureId : int
- $name : string|null
- $limit : int|null = 100
- $parentId : int|null = null
- $depth : DepthLevel|int = DepthLevel::FULL
- $strict : bool = false
- $activeFilter : NodeActiveFilter = NodeActiveFilter::ONLY_GLOBAL_ACTIVE
Return values
NodeCollectiongetParentOf()
public
getParentOf(Node $node[, DepthLevel|int $depthLevel = DepthLevel::FIRST ]) : NodeCollection
Parameters
- $node : Node
- $depthLevel : DepthLevel|int = DepthLevel::FIRST
Return values
NodeCollectiongetRootNodeByStructureId()
Retrieves the root node by structure id.
public
getRootNodeByStructureId(int $structureId) : Node|null
Parameters
- $structureId : int
Tags
Return values
Node|nullhasChild()
public
hasChild(Node $node) : bool
Parameters
- $node : Node
Return values
boolisAncestor()
public
isAncestor(Node $node, Node $targetNode) : bool
Parameters
Return values
boolupdate()
public
update(Node $node) : Node
Parameters
- $node : Node