MINOR Using new API methods after SQLQuery API changes

This commit is contained in:
Sean Harvey 2012-05-07 11:24:13 +12:00
parent f545f52c1a
commit 45810a1848

View File

@ -74,9 +74,9 @@ abstract class CMSSiteTreeFilter extends Object {
if(!empty($parents)) { if(!empty($parents)) {
$q = new SQLQuery(); $q = new SQLQuery();
$q->select(array('"ID"','"ParentID"')) $q->setSelect(array('"ID"','"ParentID"'))
->from('"SiteTree"') ->setFrom('"SiteTree"')
->where('"ID" in ('.implode(',',array_keys($parents)).')'); ->setWhere('"ID" in ('.implode(',',array_keys($parents)).')');
foreach($q->execute() as $row) { foreach($q->execute() as $row) {
if ($row['ParentID']) $parents[$row['ParentID']] = true; if ($row['ParentID']) $parents[$row['ParentID']] = true;
@ -144,10 +144,10 @@ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
function pagesIncluded() { function pagesIncluded() {
$ids = array(); $ids = array();
$q = new SQLQuery(); $q = new SQLQuery();
$q->select(array('"SiteTree"."ID"','"SiteTree"."ParentID"')) $q->setSelect(array('"SiteTree"."ID"','"SiteTree"."ParentID"'))
->from('"SiteTree"') ->setFrom('"SiteTree"')
->leftJoin('SiteTree_Live', '"SiteTree_Live"."ID" = "SiteTree"."ID"') ->addLeftJoin('SiteTree_Live', '"SiteTree_Live"."ID" = "SiteTree"."ID"')
->where('"SiteTree"."Version" > "SiteTree_Live"."Version"'); ->setWhere('"SiteTree"."Version" > "SiteTree_Live"."Version"');
foreach($q->execute() as $row) { foreach($q->execute() as $row) {
$ids[] = array('ID'=>$row['ID'],'ParentID'=>$row['ParentID']); $ids[] = array('ID'=>$row['ID'],'ParentID'=>$row['ParentID']);
@ -176,8 +176,8 @@ class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter {
function pagesIncluded() { function pagesIncluded() {
$ids = array(); $ids = array();
$q = new SQLQuery(); $q = new SQLQuery();
$q->select(array('"ID"','"ParentID"')) $q->setSelect(array('"ID"','"ParentID"'))
->from('"SiteTree"'); ->setFrom('"SiteTree"');
$where = array(); $where = array();
$SQL_params = Convert::raw2sql($this->params); $SQL_params = Convert::raw2sql($this->params);
@ -207,7 +207,7 @@ class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter {
} }
} }
} }
$q->where(empty($where) ? '' : '(' . implode(') AND (',$where) . ')'); $q->setWhere(empty($where) ? '' : '(' . implode(') AND (',$where) . ')');
foreach($q->execute() as $row) { foreach($q->execute() as $row) {
$ids[] = array('ID'=>$row['ID'],'ParentID'=>$row['ParentID']); $ids[] = array('ID'=>$row['ID'],'ParentID'=>$row['ParentID']);