Baum\Node::getDepthColumnName PHP Method

getDepthColumnName() public method

Get the "depth" field column name.
public getDepthColumnName ( ) : string
return string
    public function getDepthColumnName()
    {
        return $this->depthColumn;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Flattens an array to contain 'id', 'lft', 'rgt', 'depth', 'parent_id' as a valid tree
  * @param $nestableArray
  * @param mixed $parent_id
  * @param int $depth
  * @param int $bound
  * @return array
  */
 public function flattenNestable($nodeList, $parent_id = null, $depth = 0, &$bound = 0)
 {
     $nodes = array();
     foreach ($nodeList as $node) {
         $lft = ++$bound;
         $children = array_get($node, $this->childrenKeyName, []);
         if (!empty($children)) {
             $children = $this->flattenNestable($children, array_get($node, $this->node->getKeyName()), $depth + 1, $bound);
         }
         $rgt = ++$bound;
         $nodes[] = array($this->node->getKeyName() => array_get($node, $this->node->getKeyName()), $this->node->getParentColumnName() => $parent_id, $this->node->getDepthColumnName() => $depth, $this->node->getLeftColumnName() => $lft, $this->node->getRightColumnName() => $rgt);
         $nodes = array_merge($nodes, $children);
     }
     return $nodes;
 }