DB_NestedSet::isParent

DB_NestedSet::isParent() – See if a given node is a parent of another given node

Synopsis

require_once 'DB/NestedSet.php';

bool DB_NestedSet::isParent ( mixed $parent , mixed $child )

Description

A node is considered to be a parent if it resides above the child So it doesn't mean that the node has to be an immediate parent. To get this information simply compare the levels of the two nodes after you know that you have a parent relation.

Parameter

mixed $parent

The parent node as array or object

mixed $child

The child node as array or object

Return value

returns True if it's a parent

Throws

throws no exceptions thrown

Note

This function can not be called statically.

Example

IsParent

<?php
require_once('DB/NestedSet.php');
    
$nestedSet =& DB_NestedSet::factory('DB'$dsn$params);
    
$parent $nestedSet->createRootNode(array('name' => 'root-node'));
    
$node $nestedSet->createSubNode($parent, array('name' => 'sub1'));
    
$boolparent $nestedSet->isParent($parent$node);
?>
Fetch all the children of a node given by id (Previous) Wrapper for node moving and copying (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.