mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #538 from halkyon/query_changes
Fixing DataList to be used correctly in a few core classes
This commit is contained in:
commit
9de2b0b1b6
@ -742,7 +742,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -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) . ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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),
|
||||||
|
Loading…
Reference in New Issue
Block a user