/** * Return the "where" portion of the SQL statement (without the where prefix) * @param Criteria $criteria the Criteria object to which this filter has been added */ public function GetWhere($criteria) { if ($this->Type != self::$TYPE_SEARCH) { throw new Exception('Unsupported Filter Type'); } // normalize property names as an array $propertyNames = is_array($this->PropertyNames) ? $this->PropertyNames : explode(',', $this->PropertyNames); $where = ' ('; $orDelim = ''; foreach ($propertyNames as $propName) { $dbfield = $criteria->GetFieldFromProp($propName); $where .= $orDelim . $criteria->Escape($dbfield) . " like " . $criteria->GetQuotedSql($this->Value) . ""; $orDelim = ' or '; } $where .= ') '; return $where; }