class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Interface (View source)

Doctrine_Node_NestedSet

Properties

protected $record from Doctrine_Node
protected $options from Doctrine_Node
protected $iteratorType from Doctrine_Node
protected $iteratorOptions from Doctrine_Node
protected unknown_type $_tree The tree to which the node belongs. from Doctrine_Node

Methods

__construct(Doctrine_Record $record, array $options)

contructor, creates node with reference to record and any options

static Doctrine_Node
factory(Doctrine_Record $record, string $implName, array $options = array())

Factory method for creating a Node.

setRecord(Doctrine_Record $record)

setter for record attribute

getRecord()

getter for record attribute

traverse(string $type = 'Pre', array $options = array())

convenience function for getIterator

getIterator(string $type = null, array $options = null)

get iterator

setIteratorType(int $type)

sets node's iterator type

setIteratorOptions(int $options)

sets node's iterator options

bool
hasPrevSibling()

test if node has previous sibling

bool
hasNextSibling()

test if node has next sibling

bool
hasChildren()

test if node has children

bool
hasParent()

test if node has parent

getPrevSibling()

gets record of prev sibling or empty record

getNextSibling()

gets record of next sibling or empty record

array
getSiblings($includeNode = false)

gets siblings for node

getFirstChild()

gets record of first child or empty record

getLastChild()

gets record of last child or empty record

array
getChildren()

gets children for node (direct descendants only)

getDescendants($depth = null, $includeNode = false)

gets descendants for node (direct descendants only)

getParent()

gets record of parent or empty record

getAncestors($depth = null)

gets ancestors for node

string
getPath(string $seperator = ' > ', $includeRecord = false)

gets path to node from root, uses record::toString() method to get node names

int
getNumberChildren()

gets number of children (direct descendants)

int
getNumberDescendants()

gets number of descendants (children and their children)

bool
insertAsParentOf(Doctrine_Record $dest)

inserts node as parent of dest record

bool
insertAsPrevSiblingOf(Doctrine_Record $dest)

inserts node as previous sibling of dest record

bool
insertAsNextSiblingOf(Doctrine_Record $dest)

inserts node as next sibling of dest record

bool
insertAsFirstChildOf(Doctrine_Record $dest)

inserts node as first child of dest record

bool
insertAsLastChildOf(Doctrine_Record $dest)

inserts node as last child of dest record

moveAsPrevSiblingOf(Doctrine_Record $dest)

moves node as prev sibling of dest record

moveAsNextSiblingOf(Doctrine_Record $dest)

moves node as next sibling of dest record

moveAsFirstChildOf(Doctrine_Record $dest)

moves node as first child of dest record

moveAsLastChildOf(Doctrine_Record $dest)

moves node as last child of dest record

makeRoot($newRootId)

Makes this node a root node. Only used in multiple-root trees.

addChild(Doctrine_Record $record)

adds node as last child of record

bool
isLeaf()

determines if node is leaf

bool
isRoot()

determines if node is root

bool
isEqualTo(Doctrine_Record $subj)

determines if node is equal to subject node

bool
isDescendantOf(Doctrine_Record $subj)

determines if node is child of subject node

bool
isDescendantOfOrEqualTo(Doctrine_Record $subj)

determines if node is child of or sibling to subject node

bool
isAncestorOf(Doctrine_Record $subj)

determines if node is ancestor of subject node

bool
isValidNode($record = null)

determines if node is valid

detach()

Detaches the node from the tree by invalidating it's lft & rgt values (they're set to 0).

delete()

deletes node and it's descendants

int
getLeftValue()

gets record's left value

setLeftValue(int $lft)

sets record's left value

int
getRightValue()

gets record's right value

setRightValue(int $rgt)

sets record's right value

int
getLevel()

gets level (depth) of node in the tree

getRootValue()

get records root id value

setRootValue(int $value)

sets records root id value

Details

__construct(Doctrine_Record $record, array $options)

contructor, creates node with reference to record and any options

Parameters

Doctrine_Record $record instance of Doctrine_Record
array $options options

static Doctrine_Node factory(Doctrine_Record $record, string $implName, array $options = array())

Factory method for creating a Node.

This is a factory method that returns node instance based upon chosen implementation.

Parameters

Doctrine_Record $record instance of Doctrine_Record
string $implName implementation (NestedSet, AdjacencyList, MaterializedPath)
array $options options

Return Value

Doctrine_Node

Exceptions

Doctrine_Node_Exception if $implName is not a valid class

setRecord(Doctrine_Record $record)

setter for record attribute

Parameters

Doctrine_Record $record instance of Doctrine_Record

Doctrine_Record getRecord()

getter for record attribute

Return Value

Doctrine_Record

traverse(string $type = 'Pre', array $options = array())

convenience function for getIterator

Parameters

string $type type of iterator (Pre | Post | Level)
array $options options

getIterator(string $type = null, array $options = null)

get iterator

Parameters

string $type type of iterator (Pre | Post | Level)
array $options options

setIteratorType(int $type)

sets node's iterator type

Parameters

int $type

setIteratorOptions(int $options)

sets node's iterator options

Parameters

int $options

bool hasPrevSibling()

test if node has previous sibling

Return Value

bool

bool hasNextSibling()

test if node has next sibling

Return Value

bool

bool hasChildren()

test if node has children

Return Value

bool

bool hasParent()

test if node has parent

Return Value

bool

Doctrine_Record getPrevSibling()

gets record of prev sibling or empty record

Return Value

Doctrine_Record

Doctrine_Record getNextSibling()

gets record of next sibling or empty record

Return Value

Doctrine_Record

array getSiblings($includeNode = false)

gets siblings for node

Parameters

$includeNode

Return Value

array array of sibling Doctrine_Record objects

Doctrine_Record getFirstChild()

gets record of first child or empty record

Return Value

Doctrine_Record

Doctrine_Record getLastChild()

gets record of last child or empty record

Return Value

Doctrine_Record

array getChildren()

gets children for node (direct descendants only)

Return Value

array array of sibling Doctrine_Record objects

Iterator getDescendants($depth = null, $includeNode = false)

gets descendants for node (direct descendants only)

Parameters

$depth
$includeNode

Return Value

Iterator iterator to traverse descendants from node

Doctrine_Record getParent()

gets record of parent or empty record

Return Value

Doctrine_Record

Doctrine_Collection getAncestors($depth = null)

gets ancestors for node

Parameters

$depth

Return Value

Doctrine_Collection

string getPath(string $seperator = ' > ', $includeRecord = false)

gets path to node from root, uses record::toString() method to get node names

Parameters

string $seperator path seperator
$includeRecord

Return Value

string string representation of path

int getNumberChildren()

gets number of children (direct descendants)

Return Value

int

int getNumberDescendants()

gets number of descendants (children and their children)

Return Value

int

bool insertAsParentOf(Doctrine_Record $dest)

inserts node as parent of dest record

Parameters

Doctrine_Record $dest

Return Value

bool

bool insertAsPrevSiblingOf(Doctrine_Record $dest)

inserts node as previous sibling of dest record

Parameters

Doctrine_Record $dest

Return Value

bool

bool insertAsNextSiblingOf(Doctrine_Record $dest)

inserts node as next sibling of dest record

Parameters

Doctrine_Record $dest

Return Value

bool

bool insertAsFirstChildOf(Doctrine_Record $dest)

inserts node as first child of dest record

Parameters

Doctrine_Record $dest

Return Value

bool

bool insertAsLastChildOf(Doctrine_Record $dest)

inserts node as last child of dest record

Parameters

Doctrine_Record $dest

Return Value

bool

moveAsPrevSiblingOf(Doctrine_Record $dest)

moves node as prev sibling of dest record

Parameters

Doctrine_Record $dest

moveAsNextSiblingOf(Doctrine_Record $dest)

moves node as next sibling of dest record

Parameters

Doctrine_Record $dest

moveAsFirstChildOf(Doctrine_Record $dest)

moves node as first child of dest record

Parameters

Doctrine_Record $dest

moveAsLastChildOf(Doctrine_Record $dest)

moves node as last child of dest record

Parameters

Doctrine_Record $dest

makeRoot($newRootId)

Makes this node a root node. Only used in multiple-root trees.

Parameters

$newRootId

addChild(Doctrine_Record $record)

adds node as last child of record

Parameters

Doctrine_Record $record

bool isLeaf()

determines if node is leaf

Return Value

bool

bool isRoot()

determines if node is root

Return Value

bool

bool isEqualTo(Doctrine_Record $subj)

determines if node is equal to subject node

Parameters

Doctrine_Record $subj

Return Value

bool

bool isDescendantOf(Doctrine_Record $subj)

determines if node is child of subject node

Parameters

Doctrine_Record $subj

Return Value

bool

bool isDescendantOfOrEqualTo(Doctrine_Record $subj)

determines if node is child of or sibling to subject node

Parameters

Doctrine_Record $subj

Return Value

bool

bool isAncestorOf(Doctrine_Record $subj)

determines if node is ancestor of subject node

Parameters

Doctrine_Record $subj

Return Value

bool

bool isValidNode($record = null)

determines if node is valid

Parameters

$record

Return Value

bool

detach()

Detaches the node from the tree by invalidating it's lft & rgt values (they're set to 0).

delete()

deletes node and it's descendants

int getLeftValue()

gets record's left value

Return Value

int

setLeftValue(int $lft)

sets record's left value

Parameters

int $lft

int getRightValue()

gets record's right value

Return Value

int

setRightValue(int $rgt)

sets record's right value

Parameters

int $rgt

int getLevel()

gets level (depth) of node in the tree

Return Value

int

getRootValue()

get records root id value

setRootValue(int $value)

sets records root id value

Parameters

int $value