‪TYPO3CMS  11.5
TYPO3\CMS\Backend\Tree\TreeNode Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Tree\TreeNode:
TYPO3\CMS\Backend\Tree\ComparableNodeInterface TYPO3\CMS\Backend\Tree\TreeRepresentationNode TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode

Public Member Functions

 __construct (array $data=[])
 
 setChildNodes (TreeNodeCollection $childNodes)
 
 removeChildNodes ()
 
TreeNodeCollection getChildNodes ()
 
bool hasChildNodes ()
 
 setId ($id)
 
string int getId ()
 
 setParentNode (?TreeNode $parentNode=null)
 
TreeNode getParentNode ()
 
bool equals (TreeNode $other)
 
int compareTo ($other)
 
 getAdditionalData ()
 
array toArray ($addChildNodes=true)
 
 dataFromArray ($data)
 
string serialize ()
 
 __serialize ()
 
 unserialize ($serializedString)
 
 __unserialize (array $arrayRepresentation)
 

Protected Attributes

string int $id = ''
 
TreeNode null $parentNode
 
TreeNodeCollection null $childNodes
 
array $additionalData = []
 

Detailed Description

Tree Node

Definition at line 24 of file TreeNode.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Tree\TreeNode::__construct ( array  $data = [])

Constructor

You can move an initial data array to initialize the instance and further objects. This is useful for the deserialization.

Parameters
array$data

Definition at line 57 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\dataFromArray().

Member Function Documentation

◆ __serialize()

TYPO3\CMS\Backend\Tree\TreeNode::__serialize ( )

Returns class state to be serialized.

Definition at line 247 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\toArray().

Referenced by TYPO3\CMS\Backend\Tree\TreeNode\serialize().

◆ __unserialize()

TYPO3\CMS\Backend\Tree\TreeNode::__unserialize ( array  $arrayRepresentation)

Fills the current node with the given serialized information

Exceptions
Exception‪if the deserialized object type is not identical to the current one

Definition at line 269 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\dataFromArray().

Referenced by TYPO3\CMS\Backend\Tree\TreeNode\unserialize().

◆ compareTo()

int TYPO3\CMS\Backend\Tree\TreeNode::compareTo (   $other)

Compares a node to another one.

Returns: 1 if its greater than the other one -1 if its smaller than the other one 0 if its equal

Parameters
TreeNode$other
Returns
‪int See description above

Implements TYPO3\CMS\Backend\Tree\ComparableNodeInterface.

Reimplemented in TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode.

Definition at line 170 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\equals().

Referenced by TYPO3\CMS\Backend\Tree\TreeNodeCollection\nodeCompare().

◆ dataFromArray()

◆ equals()

bool TYPO3\CMS\Backend\Tree\TreeNode::equals ( TreeNode  $other)

Compares a node if it's identical to another node by the id property.

Parameters
TreeNode$other
Returns
‪bool

Definition at line 154 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\getId().

Referenced by TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode\compareTo(), and TYPO3\CMS\Backend\Tree\TreeNode\compareTo().

◆ getAdditionalData()

TYPO3\CMS\Backend\Tree\TreeNode::getAdditionalData ( )

This is part of the category tree performance hack

Definition at line 181 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\$additionalData.

Referenced by TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider\buildRepresentationForNode().

◆ getChildNodes()

◆ getId()

◆ getParentNode()

TreeNode TYPO3\CMS\Backend\Tree\TreeNode::getParentNode ( )

Returns the parent node

Returns
TreeNode

Definition at line 143 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\$parentNode.

◆ hasChildNodes()

◆ removeChildNodes()

TYPO3\CMS\Backend\Tree\TreeNode::removeChildNodes ( )

Removes child nodes collection

Definition at line 77 of file TreeNode.php.

◆ serialize()

string TYPO3\CMS\Backend\Tree\TreeNode::serialize ( )

Returns the serialized instance

Returns
‪string
Todo:
‪: Drop method and \Serializable class interface in v12.

Definition at line 239 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\__serialize().

◆ setChildNodes()

◆ setId()

◆ setParentNode()

TYPO3\CMS\Backend\Tree\TreeNode::setParentNode ( ?TreeNode  $parentNode = null)

Sets the parent node

Parameters
TreeNode | null$parentNode

Definition at line 133 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\$parentNode.

Referenced by TYPO3\CMS\Backend\Tree\TreeNode\dataFromArray().

◆ toArray()

array TYPO3\CMS\Backend\Tree\TreeNode::toArray (   $addChildNodes = true)

Returns the node in an array representation that can be used for serialization

Parameters
bool$addChildNodes
Returns
‪array

Reimplemented in TYPO3\CMS\Backend\Tree\TreeRepresentationNode.

Definition at line 192 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\$id, and TYPO3\CMS\Backend\Tree\TreeNode\hasChildNodes().

Referenced by TYPO3\CMS\Backend\Tree\TreeNode\__serialize().

◆ unserialize()

TYPO3\CMS\Backend\Tree\TreeNode::unserialize (   $serializedString)

Create class state from serialized array.

Parameters
string$serializedString
Exceptions
Exception‪if the deserialized object type is not identical to the current one
Todo:
‪: Drop method and \Serializable class interface in v12.

Definition at line 259 of file TreeNode.php.

References TYPO3\CMS\Backend\Tree\TreeNode\__unserialize().

Member Data Documentation

◆ $additionalData

array TYPO3\CMS\Backend\Tree\TreeNode::$additionalData = []
protected

This is part of the category tree performance hack.

Definition at line 47 of file TreeNode.php.

Referenced by TYPO3\CMS\Backend\Tree\TreeNode\getAdditionalData().

◆ $childNodes

TreeNodeCollection null TYPO3\CMS\Backend\Tree\TreeNode::$childNodes
protected

◆ $id

string int TYPO3\CMS\Backend\Tree\TreeNode::$id = ''
protected

◆ $parentNode

TreeNode null TYPO3\CMS\Backend\Tree\TreeNode::$parentNode
protected