Source API for the «PortePlugins_Hierarchy» class

Plugin to add hierarchical functionnalities to record manipulation using the nested set model implementation.

PHP magic methods

__construct

This method is not yet documented.

Public methods

getParent

Return the parent record. Result is cached after its first retrieval but it is possible to force its reloading by setting the 'force' option.

Options include

	force bool Force the reloading of the record
return
object
Parent record or null if current record is root
getSibling

This method is not yet documented.

getChildren

Return the children associated to this record. Records are cached unless the option 'force' is present. The level of depth can be provided with the option 'depth'. If the depth is 1, only the direct descendants are retrieved, if greated than 1, this indicate the number of level in the hierarchy, if equals or less than 0, the number of level is infinite.

Available options:

	force bool Force the reloading of children
	depth int Level of depth to load sub-children
	flatten bool Return all the record instead of the direct descendants
return
array
Array of records
Object[optional]
$options
getRootline

Return the parents of the current child. The method only apply to record which have been previously saved (inserted into the rootline) otherwise false is returned.

Option include all the options present in 'find' method plus:

	exclude_itself Include current child in the rootline
return
Array
of parent records
Object[optional]
$index
getDepth

Count the depth of the current record relative to the root record. If the current record is the root record, its depth will always be equals to 0.

return
depth (int)
array[optional]
$options
isRoot

Check wether the current record is the root record.

return
boolean
True if records is root record
getRoot

Return the root record. There is only one root record for a given type of records.

return
PorteRecord
The root record
addChild

Add a child record to the current record.

return
PorteRecord
The current record
PorteRecord
$child
setParent

Set a record as the parent of the current record, in other words, move the current record as a child of the provided record.

return
PorteRecord
The current record
PorteRecord
$parent, The
new parent of the current record
countChildren

Count the number of children own by this child. By default, it return the number of direct descendants, but this behavior can be altered with the 'depth' option. If 'depth' is zero or negative, all the descendant will be included. If 'depth' is 1, only the direct descendant are included.

Options includes

	depth int Level of depth to search for, default 1
return
int
Number of children
array
$options
hasChildren

This method is not yet documented.

deleteChildren

Remove from the database all the children of the current record.

return
PorteRecord
The current record
_recordLoadAfter

This method is not yet documented.

_recordCreateBefore

Listener called before a record is created.

return
Object
$record
_recordUpdateBefore

This method is not yet documented.

_recordSaveAfter

This method is not yet documented.

_recordDeleteBefore

This method is not yet documented.

_HierarchicalDeleteBefore

This method is not yet documented.

hierarchicalClean

This method is not yet documented.

Public static methods

register

Register the plugin with a Porte instance.

_getSibling

This method is not yet documented.

_getRootline

This method is not yet documented.

_getDepth

This method is not yet documented.

_isRoot

This method is not yet documented.

_getRoot

This method is not yet documented.

_deleteChildren

This method is not yet documented.

isValid

This method is not yet documented.

sanitize

This method is not yet documented.

_recordModelBefore

This method is not yet documented.

_recordGet

This method is not yet documented.