Methods summary
public
Charcoal\Object\HierarchicalInterface
|
|
public
Charcoal\Object\HierarchicalInterface
|
#
setMaster( mixed $master )
Set this object's immediate parent.
Set this object's immediate parent.
Parameters
- $master
- The object's parent (or master).
Returns
Throws
UnexpectedValueException The current object cannot be its own parent.
|
public
Charcoal\Object\HierarchicalInterface |null
|
#
master( )
Retrieve this object's immediate parent.
Retrieve this object's immediate parent.
Returns
|
public
boolean
|
#
hasMaster( )
Determine if this object has a direct parent.
Determine if this object has a direct parent.
Returns
boolean
|
public
boolean
|
#
isTopLevel( )
Determine if this object is the head (top-level) of its hierarchy.
Determine if this object is the head (top-level) of its hierarchy.
Top-level objects do not have a parent (master).
Returns
boolean
|
public
boolean
|
#
isLastLevel( )
Determine if this object is the tail (last-level) of its hierarchy.
Determine if this object is the tail (last-level) of its hierarchy.
Last-level objects do not have a children.
Returns
boolean
|
public
integer
|
#
hierarchyLevel( )
Retrieve this object's position (level) in its hierarchy.
Retrieve this object's position (level) in its hierarchy.
Starts at "1" (top-level).
The level is calculated by loading all ancestors with self::hierarchy().
Returns
integer
|
public
Charcoal\Object\HierarchicalInterface |null
|
#
toplevelMaster( )
Retrieve the top-level ancestor of this object.
Retrieve the top-level ancestor of this object.
Returns
|
public
boolean
|
#
hasParents( )
Determine if this object has any ancestors.
Determine if this object has any ancestors.
Returns
boolean
|
public
array
|
#
hierarchy( )
Retrieve this object's ancestors (from immediate parent to top-level).
Retrieve this object's ancestors (from immediate parent to top-level).
Returns
array
|
public
array
|
#
invertedHierarchy( )
Retrieve this object's ancestors, inverted from top-level to immediate.
Retrieve this object's ancestors, inverted from top-level to immediate.
Returns
array
|
public
boolean
|
#
isMasterOf( mixed $child )
Determine if the object is the parent of the given object.
Determine if the object is the parent of the given object.
Parameters
- $child
- The child (or ID) to match against.
Returns
boolean
|
public
boolean
|
#
recursiveIsMasterOf( mixed $child )
Determine if the object is a parent/ancestor of the given object.
Determine if the object is a parent/ancestor of the given object.
Parameters
- $child
- The child (or ID) to match against.
Returns
boolean
|
public
boolean
|
#
hasChildren( )
Get wether the object has any children at all
Get wether the object has any children at all
Returns
boolean
|
public
integer
|
#
numChildren( )
Get the number of children directly under this object.
Get the number of children directly under this object.
Returns
integer
|
public
integer
|
#
recursiveNumChildren( )
Get the total number of children in the entire hierarchy.
This method counts all children and sub-children, unlike numChildren() which only count 1 level.
Get the total number of children in the entire hierarchy.
This method counts all children and sub-children, unlike numChildren() which only count 1 level.
Returns
integer
|
public
Charcoal\Object\HierarchicalInterface
|
#
setChildren( array $children )
Parameters
- $children
- The children to set.
Returns
|
public
Charcoal\Object\HierarchicalInterface
|
#
addChild( mixed $child )
Parameters
- $child
- The child object (or ident) to add.
Returns
Throws
UnexpectedValueException The current object cannot be its own child.
|
public
array
|
#
children( )
Get the children directly under this object.
Get the children directly under this object.
Returns
array
|
abstract public
array
|
|
public
boolean
|
#
isChildOf( mixed $master )
Parameters
- $master
- The master object (or ident) to check against.
Returns
boolean
|
public
boolean
|
#
recursiveIsChildOf( mixed $master )
Parameters
- $master
- The master object (or ident) to check against.
Returns
boolean
|
public
boolean
|
|
public
integer
|
|
public
array
|
#
siblings( )
Get all the objects on the same level as this one.
Get all the objects on the same level as this one.
Returns
array
|
public
boolean
|
#
isSiblingOf( mixed $sibling )
Parameters
- $sibling
- The sibling to check.
Returns
boolean
|
abstract public
Charcoal\Factory\FactoryInterface
|
#
modelFactory( )
Retrieve the object model factory.
Retrieve the object model factory.
Returns
Charcoal\Factory\FactoryInterface
|