BUGFIX: Fix site tree filter not showing parents of results more than a level deep in the hierachy

This commit is contained in:
Andrew O'Neil 2012-09-04 14:51:14 +12:00
parent 4ad2b25679
commit f843dd56dc
1 changed files with 4 additions and 2 deletions

View File

@ -71,13 +71,15 @@ abstract class CMSSiteTreeFilter extends Object {
$parents[$pageArr['ParentID']] = true;
$this->_cache_ids[$pageArr['ID']] = true;
}
if(!empty($parents)) {
while(!empty($parents)) {
$q = new SQLQuery();
$q->setSelect(array('"ID"','"ParentID"'))
->setFrom('"SiteTree"')
->setWhere('"ID" in ('.implode(',',array_keys($parents)).')');
$parents = array();
foreach($q->execute() as $row) {
if ($row['ParentID']) $parents[$row['ParentID']] = true;
$this->_cache_ids[$row['ID']] = true;