Merge pull request #538 from halkyon/query_changes

Fixing DataList to be used correctly in a few core classes
This commit is contained in:
Sam Minnée 2012-06-14 20:51:39 -07:00
commit 9de2b0b1b6
6 changed files with 9 additions and 8 deletions

View File

@ -742,8 +742,10 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$files = File::get()->where(implode(' OR ', $wheres)); $files = File::get()->where(implode(' OR ', $wheres));
// Limit by folder (if required) // Limit by folder (if required)
if($parentID) $files->filter('ParentID', $parentID); if($parentID) {
$files = $files->filter('ParentID', $parentID);
}
return $files; return $files;
} }

View File

@ -591,7 +591,7 @@ class Hierarchy extends DataExtension {
$ids = $stageChildren->column("ID"); $ids = $stageChildren->column("ID");
if($ids) { if($ids) {
$children->where("\"$baseClass\".\"ID\" NOT IN (" . implode(',',$ids) . ")"); $children = $children->where("\"$baseClass\".\"ID\" NOT IN (" . implode(',',$ids) . ")");
} }
} }

View File

@ -25,7 +25,7 @@ class EndsWithFilter extends SearchFilter {
*/ */
public function apply(DataQuery $query) { public function apply(DataQuery $query) {
$this->model = $query->applyRelation($this->relation); $this->model = $query->applyRelation($this->relation);
$query->where($this->getDbName() . " LIKE '%" . Convert::raw2sql($this->getValue()) . "'"); return $query->where($this->getDbName() . " LIKE '%" . Convert::raw2sql($this->getValue()) . "'");
} }
public function isEmpty() { public function isEmpty() {

View File

@ -28,12 +28,11 @@
class FulltextFilter extends SearchFilter { class FulltextFilter extends SearchFilter {
public function apply(DataQuery $query) { public function apply(DataQuery $query) {
$query->where(sprintf( return $query->where(sprintf(
"MATCH (%s) AGAINST ('%s')", "MATCH (%s) AGAINST ('%s')",
$this->getDbName(), $this->getDbName(),
Convert::raw2sql($this->getValue()) Convert::raw2sql($this->getValue())
)); ));
return $query;
} }
public function isEmpty() { public function isEmpty() {

View File

@ -25,7 +25,7 @@ class StartsWithFilter extends SearchFilter {
*/ */
public function apply(DataQuery $query) { public function apply(DataQuery $query) {
$this->model = $query->applyRelation($this->relation); $this->model = $query->applyRelation($this->relation);
$query->where($this->getDbName() . " LIKE '" . Convert::raw2sql($this->getValue()) . "%'"); return $query->where($this->getDbName() . " LIKE '" . Convert::raw2sql($this->getValue()) . "%'");
} }
public function isEmpty() { public function isEmpty() {

View File

@ -27,7 +27,7 @@ class WithinRangeFilter extends SearchFilter {
function apply(DataQuery $query) { function apply(DataQuery $query) {
$this->model = $query->applyRelation($this->relation); $this->model = $query->applyRelation($this->relation);
$query->where(sprintf( return $query->where(sprintf(
"%s >= '%s' AND %s <= '%s'", "%s >= '%s' AND %s <= '%s'",
$this->getDbName(), $this->getDbName(),
Convert::raw2sql($this->min), Convert::raw2sql($this->min),