我正在使用DoctrineExtensions\NestedSet
我正在尝试渲染子节点。
$node->getChildren();
array
0 =>
object(DoctrineExtensions\NestedSet\NodeWrapper)[218]
private 'node' =>
object(Application\Models\Post)[240]
protected 'id' => int 3
protected 'title' => string 'trying to use zend_auth' (length=23)
protected 'body' => string 'hello world' (length=11)
protected 'thumbnail' => string '' (length=0)
protected 'dtPosted' =>
object(DateTime)[252]
...
protected 'dtLastAction' =>
object(DateTime)[247]
...
protected 'lft' => int 2
protected 'rgt' => int 3
protected 'root' => int 1
protected 'user' =>
object(Application\Proxies\ApplicationModelsUserProxy)[159]
...
protected 'tags' =>
object(Doctrine\ORM\PersistentCollection)[233]
...
private 'manager' =>
object(DoctrineExtensions\NestedSet\Manager)[204]
...
我得到了NodeWrapper
个数组。我正试图从中获取Post
对象。我该怎么做?
答案 0 :(得分:0)
从NodeWrapper $n
,调用$n->getNode()
以获取NodeWrapper包装的项目。