2010-08-16 105 views
0

我使用DoctrineExtensions\NestedSetDoctrine2 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

NodeWrapper $n,請撥打$n->getNode()以獲取由NodeWrapper包裝的項目。