Pimcore\Model\Object\ClassDefinition\Data::getFilterConditionExt PHP Method

getFilterConditionExt() public method

returns sql query statement to filter according to this data types value(s)
public getFilterConditionExt ( $value, $operator, $params = [] ) : string
$value
$operator
$params optional params used to change the behavior
return string
    public function getFilterConditionExt($value, $operator, $params = [])
    {
        $db = \Pimcore\Db::get();
        $name = $params["name"] ? $params["name"] : $this->name;
        $key = $db->quoteIdentifier($name);
        if ($value === "NULL") {
            if ($operator == '=') {
                $operator = "IS";
            } elseif ($operator == "!=") {
                $operator = "IS NOT";
            }
        } elseif (!is_array($value) && !is_object($value)) {
            if ($operator == "LIKE") {
                $value = $db->quote("%" . $value . "%");
            } else {
                $value = $db->quote($value);
            }
        }
        if (in_array($operator, Object\ClassDefinition\Data::$validFilterOperators)) {
            return $key . " " . $operator . " " . $value . " ";
        } else {
            return "";
        }
    }