src/ORM/Filters/MatchObjectFilter.php
public function getFilter()
    {
        if (!is_array($this->data)) {
            return null;
        }
        $allowed = array_keys(DataObject::getSchema()->databaseFields($this->className));
        $fields = array_flip(array_intersect($allowed, $this->required));
        $singleton = singleton($this->className);

        $new = [];
        foreach ($fields as $field => $value) {
            $field = Convert::raw2sql($field);
            if (in_array($field, $allowed)) {
                if (isset($this->data[$field])) {
                    // allow wildcard in filter
                    if ($this->data[$field] === '*') {
                        continue;
                    }

                    $dbfield = $singleton->dbObject($field);
                    $value = $dbfield->prepValueForDB($this->data[$field]);

                    $new[] = "\"$field\" = '$value'";
                } else {
                    $new[] = "\"$field\" IS NULL";
                }
            } else {
                if (isset($this->data[$field])) {
                    $value = Convert::raw2sql($this->data[$field]);
                    $new[] = "\"$field\" = '$value'";
                } else {
                    $new[] = "\"$field\" IS NULL";
                }
            }
        }
        return $new;
    }
public function getFilter()
    {
        if (!is_array($this->data)) {
            return null;
        }
        $allowed = array_keys(DataObject::getSchema()->databaseFields($this->className));
        $fields = array_flip(array_intersect($allowed, $this->required));
        $singleton = singleton($this->className);

        $new = [];
        foreach ($fields as $field => $value) {
            $field = Convert::raw2sql($field);
            if (in_array($field, $allowed)) {
                if (isset($this->data[$field])) {
                    // allow wildcard in filter
                    if ($this->data[$field] === '*') {
                        continue;
                    }

                    $dbfield = $singleton->dbObject($field);
                    $value = $dbfield->prepValueForDB($this->data[$field]);

                    $new[] = "\"$field\" = '$value'";
                } else {
                    $new[] = "\"$field\" IS NULL";
                }
            } else {
                if (isset($this->data[$field])) {
                    $value = Convert::raw2sql($this->data[$field]);
                    $new[] = "\"$field\" = '$value'";
                } else {
                    $new[] = "\"$field\" IS NULL";
                }
            }
        }
        return $new;
    }
Create SQL where filter

@return array of filter statements