previousDB_NestedSet::getSubBranch (Previous) (Next) DB_NestedSet::moveTreenext

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

DB_NestedSet::isParent

DB_NestedSet::isParent() – 指定したノードが他のノードの親かどうかを調べる

Synopsis

require_once 'DB/NestedSet.php';

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

Description

あるノードが親ノードかどうかは、子ノードの上にあるかどうかで判断します。 つまりそのノードが実際の親かどうかはわかりません。 この情報を取得するには、単純にふたつのノードのレベルを比較します。

Parameter

mixed $parent

親ノード。配列あるいはオブジェクトで指定します。

mixed $child

子ノード。配列あるいはオブジェクトで指定します。

Return value

親ノードである場合に true を返します。

Throws

例外はスローされません。

Note

This function can not be called statically.

Example

親かどうかの判断

<?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);
?>
previousDB_NestedSet::getSubBranch (Previous) (Next) DB_NestedSet::moveTreenext

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.