Version: current

     1 <?php
     2 /**
     3  * @package sapphire
     4  * @subpackage search
     5  */
     6
     7 /**
     8  * Selects textual content with an exact match between columnname and keyword.
     9  *
    10  * @todo case sensitivity switch
    11  * @todo documentation
    12  *
    13  * @package sapphire
    14  * @subpackage search
    15  */
    16 class ExactMatchFilter extends SearchFilter {
    17
    18     /**
    19      * Applies an exact match (equals) on a field value.
    20      *
    21      * @return unknown
    22      */
    23     public function apply(SQLQuery $query) {
    24         $query = $this->applyRelation($query);
    25         return $query->where(sprintf(
    26             "%s = '%s'",
    27             $this->getDbName(),
    28             Convert::raw2sql($this->getValue())
    29         ));
    30     }
    31
    32     public function isEmpty() {
    33         return $this->getValue() == null || $this->getValue() == '';
    34     }
    35 }
    36 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -