MINOR Ensure DataQuery used in apply() is returned on Filter classes (to be consistent with GreaterThanFilter etc which will return it)

This commit is contained in:
Sean Harvey 2012-06-15 15:48:47 +12:00
parent a8e0fd07f2
commit a9c7c69289
4 changed files with 4 additions and 5 deletions

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),