views:

235

answers:

0

I have a class MenuItem act as NestedSet with many roots:

MenuItem: 
  actAs: 
    NestedSet: 
      hasManyRoots: true 
      rootColumnName: root_id 

I want to retrieve a path from root to selected node.

SQL-query for this is:

SELECT m2.* 
FROM menu_item m 
INNER JOIN menu_item m2 ON m2.lft <= m.lft AND m2.rgt >= m.rgt 
WHERE m.id = '...' 
ORDER BY m.lft 

It is possible to created a DQL-query for this task? I find it difficult, because a MenuItem not have a self-relation.