2014-06-18 4 views
0

나는 예처럼 (Doctrine2에 대한 Gedmo 중첩 된 트리 확장을 사용) 카테고리 구조를 가지고 : https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md#tree-entity-exampleDoctrine2 중첩 된 세트 들여 쓰기 테이블로 렌더링

문제는이 같은 테이블로 모든 트리를 표시하는 방법입니다 :

<table> 
    <tr> 
     <td>Category-1 name</td> 
     <td>Category-1 other data</td> 
    </tr> 
    <tr> 
     <td>Category-2 name</td> 
     <td>Category-2 other data</td> 
    </tr> 
    <tr> 
     <td><span class="indent">---</span>Subcategory-2-1 name</td> 
     <td>Subcategory-2-1 other data</td> 
    </tr> 
    <tr> 
     <td><span class="indent">---</span><span class="indent">---</span>Subcategory-2-1-1 name</td> 
     <td>Subcategory-2-1-1 other data</td> 
    </tr> 
    <tr> 
     <td>Category-3 name</td> 
     <td>Category-3 other data</td> 
    </tr> 
</table> 

또 다른 단어는 레벨 쿼리를 사용하여 일반 목록으로 트리를 가져와야합니다. 는 난 단지 배열 (getNodesHierarchy) 등의 목록을 얻을 수있는 방법을 찾았지만 발견 나는 findall은()

답변

0

라고하면 같은 모음으로 해결책을 가지고해야합니다

class CategoryRepository extends NestedTreeRepository 
{ 
    public function getTreeList() 
    { 
     return $this->getNodesHierarchyQuery()->getResult(); 
    } 
}