Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AdvancedSearchForm
  • ContentControllerSearchExtension
  • EndsWithFilter
  • ExactMatchFilter
  • ExactMatchMultiFilter
  • FulltextFilter
  • FulltextSearchable
  • GreaterThanFilter
  • LessThanFilter
  • NegationFilter
  • PartialMatchFilter
  • SearchContext
  • SearchFilter
  • SearchForm
  • StartsWithFilter
  • StartsWithMultiFilter
  • SubstringFilter
  • WithinRangeFilter
 1 <?php
 2 /**
 3  * @package sapphire
 4  * @subpackage search
 5  */
 6 
 7 /**
 8  * Checks if a value is in a given set.
 9  * SQL syntax used: Column IN ('val1','val2')
10  * 
11  * @todo Add negation (NOT IN)6
12  * @package sapphire
13  * @subpackage search
14  */
15 class ExactMatchMultiFilter extends SearchFilter {
16     
17     public function apply(SQLQuery $query) {
18         $query = $this->applyRelation($query);
19         
20         // hack
21         // PREVIOUS $values = explode(',',$this->getValue());
22         $values = array();
23         if (is_string($this->getValue())) {
24             $values = explode(',',$this->getValue());
25         }
26         else {
27             foreach($this->getValue() as $v) {
28                 $values[] = $v;
29             }
30         }
31         
32         
33         if(! $values) return false;
34         for($i = 0; $i < count($values); $i++) {
35             if(! is_numeric($values[$i])) {
36                 // @todo Fix string replacement to only replace leading and tailing quotes
37                 $values[$i] = str_replace("'", '', $values[$i]);
38                 $values[$i] = Convert::raw2sql($values[$i]);
39             }
40         }
41         $SQL_valueStr = "'" . implode("','", $values) . "'";
42         
43         return $query->where(sprintf(
44             "%s IN (%s)",
45             $this->getDbName(),
46             $SQL_valueStr
47         ));
48     }
49     
50     public function isEmpty() {
51         return $this->getValue() == null || $this->getValue() == '';
52     }
53 }
54 ?>
[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. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0