mixed
DB_NestedSet::getParents
(
int
$id
,
bool
$keepAsArray
= = false
,
bool
$aliasFields
= = true
,
array
$addSQL = array()
)
This package is not documented yet.
$id
ノード ID。
$keepAsArray
(オプション) 結果を配列で保持するか、 それを DB_NestedSet_Node オブジェクトのセットに変換するか?
$aliasFields
(オプション) フィールドのエイリアスを作成してパラメータのキーの名前とするか、 そのままにしておくか?
$addSQL
(オプション) クエリに渡す追加パラメータの配列。
ノードの配列、あるいはエラー時に false を返します。
_addSQL も参照ください。
例外はスローされません。
This function can not be called statically.
親の取得
<?php
require_once('DB/NestedSet.php');
$nestedSet =& DB_NestedSet::factory('DB', $dsn, $params);
$parent = $nestedSet->createRootNode(array('name' => 'root-node'), false, true);
$parent2 = $nestedSet->createSubNode($parent, array('name' => 'sub-node));
$parent3 = $nestedSet->createSubNode($parent2, array('name' => 'sub-node'));
$nestedSet->createSubNode($parent3, array('name' => 'sub1'));
$nestedSet->createSubNode($parent3, array('name' => 'sub2'));
$data = $nestedSet->getParents($parent3);
?>