Search::makeTextCriteria PHP Method

makeTextCriteria() static public method

Create SQL search condition
static public makeTextCriteria ( $field, $val, $not = false, $link = 'AND' ) : search
$field name (should be ` protected)
$val string value to search
$not boolean is a negative search ? (false by default)
$link with previous criteria (default 'AND')
return search SQL string
    static function makeTextCriteria($field, $val, $not = false, $link = 'AND')
    {
        $sql = $field . self::makeTextSearch($val, $not);
        if ($not && $val != 'NULL' && $val != 'null' && $val != '^$' || !$not && $val == '^$') {
            // Empty
            $sql = "({$sql} OR {$field} IS NULL)";
        }
        return " {$link} {$sql} ";
    }

Usage Example

 function getSqlCriteriasRestriction($link = 'AND')
 {
     $param = $this->getParameterValue();
     if ($param) {
         return Search::makeTextCriteria($this->getSqlField(), $param, false, $link);
     }
     return '';
 }
All Usage Examples Of Search::makeTextCriteria