Doctrine2 NestedSet扩展:渲染子节点

时间:2010-08-16 01:20:11

标签: php doctrine

我正在使用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对象。我该怎么做?

1 个答案:

答案 0 :(得分:0)

NodeWrapper $n,调用$n->getNode()以获取NodeWrapper包装的项目。