content::item::get_descendants (public)

 content::item::get_descendants -parent_id parent_id [ -depth depth ]

Defined in packages/acs-content-repository/tcl/content-item-procs.tcl

Returns the ids of every content item that is descendant of supplied parent_id.

Switches:
-parent_id (required)
-depth (optional)
how deep we should go in the hierarchy. 1 means direct children. Returns every descendant when not specified.
Returns:
list of cr_items.item_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_content_item_nested_structure content_item_nested_structure (test acs-content-repository) content::item::get_descendants content::item::get_descendants test_content_item_nested_structure->content::item::get_descendants db_list db_list (public) content::item::get_descendants->db_list

Testcases:
content_item_nested_structure
Source code:
    return [db_list get_descendants {
        with recursive descendants (item_id) as (
           select item_id, 1 as depth
             from cr_items
            where parent_id = :parent_id

           union all

           select i.item_id, d.depth + 1
             from cr_items i, descendants d
            where i.parent_id = d.item_id
              and (:depth is null or d.depth < :depth)
        ) select * from descendants
    }]
Generic XQL file:
packages/acs-content-repository/tcl/content-item-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/content-item-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/content-item-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: