- 287 名前:nobodyさん mailto:sage [2014/04/17(木) 23:45:58.91 ID:???]
- 親要素の条件は、子エンティティと比較して
lft がより小さく且つrghtがより大きいので 子エンティティを $child、モデルのエイリアスを Foo 、階層を $depth とする場合 こんな風にしたら取れるはず $childLft = $child['Foo']['lft']; $childRght = $child['Foo']['rght']; $conditions = array('Foo.lft <' => $childLft, 'Foo.rght >' => $childRght); $depth = $Foo->find('count', compact('conditions')); // 親の階層数
|

|