src/ORM/Filters/SearchFilter.php
public function getDbName()
    {
        // Special handler for "NULL" relations
        if ($this->name === "NULL") {
            return $this->name;
        }

        // Ensure that we're dealing with a DataObject.
        if (!is_subclass_of($this->model, DataObject::class)) {
            throw new InvalidArgumentException(
                "Model supplied to " . static::class . " should be an instance of DataObject."
            );
        }
        $tablePrefix = DataQuery::applyRelationPrefix($this->relation);
        $schema = DataObject::getSchema();

        if ($this->aggregate) {
            $column = $this->aggregate['column'];
            $function = $this->aggregate['function'];

            $table = $column ?
                $schema->tableForField($this->model, $column) :
                $schema->baseDataTable($this->model);

            if (!$table) {
                throw new InvalidArgumentException(sprintf(
                    'Invalid column %s for aggregate function %s on %s',
                    $column,
                    $function,
                    $this->model
                ));
            }
            return sprintf(
                '%s("%s%s".%s)',
                $function,
                $tablePrefix,
                $table,
                $column ? "\"$column\"" : '"ID"'
            );
        }


        // Check if this column is a table on the current model
        $table = $schema->tableForField($this->model, $this->name);
        if ($table) {
            return $schema->sqlColumnForField($this->model, $this->name, $tablePrefix);
        }

        // fallback to the provided name in the event of a joined column
        // name (as the candidate class doesn't check joined records)
        $parts = explode('.', $this->fullName);
        return '"' . implode('"."', $parts) . '"';
    }
public function getDbName()
    {
        // Special handler for "NULL" relations
        if ($this->name === "NULL") {
            return $this->name;
        }

        // Ensure that we're dealing with a DataObject.
        if (!is_subclass_of($this->model, DataObject::class)) {
            throw new InvalidArgumentException(
                "Model supplied to " . static::class . " should be an instance of DataObject."
            );
        }
        $tablePrefix = DataQuery::applyRelationPrefix($this->relation);
        $schema = DataObject::getSchema();

        if ($this->aggregate) {
            $column = $this->aggregate['column'];
            $function = $this->aggregate['function'];

            $table = $column ?
                $schema->tableForField($this->model, $column) :
                $schema->baseDataTable($this->model);

            if (!$table) {
                throw new InvalidArgumentException(sprintf(
                    'Invalid column %s for aggregate function %s on %s',
                    $column,
                    $function,
                    $this->model
                ));
            }
            return sprintf(
                '%s("%s%s".%s)',
                $function,
                $tablePrefix,
                $table,
                $column ? "\"$column\"" : '"ID"'
            );
        }


        // Check if this column is a table on the current model
        $table = $schema->tableForField($this->model, $this->name);
        if ($table) {
            return $schema->sqlColumnForField($this->model, $this->name, $tablePrefix);
        }

        // fallback to the provided name in the event of a joined column
        // name (as the candidate class doesn't check joined records)
        $parts = explode('.', $this->fullName);
        return '"' . implode('"."', $parts) . '"';
    }
public function getDbName ( ) { // Special handler for "NULL" relations if ( $ this -> name === "NULL" ) { return $ this -> name ; } // Ensure that we're dealing with a DataObject. if ( ! is_subclass_of ( $ this -> model , DataObject :: class ) ) { throw new InvalidArgumentException ( "Model supplied to " . static :: class . " should be an instance of DataObject." ) ; } $ tablePrefix = DataQuery :: applyRelationPrefix ( $ this -> relation ) ; $ schema = DataObject :: getSchema ( ) ; if ( $ this -> aggregate ) { $ column = $ this -> aggregate [ 'column' ] ; $ function = $ this -> aggregate [ 'function' ] ; $ table = $ column ? $ schema -> tableForField ( $ this -> model , $ column ) : $ schema -> baseDataTable ( $ this -> model ) ; if ( ! $ table ) { throw new InvalidArgumentException ( sprintf ( 'Invalid column %s for aggregate function %s on %s' , $ column , $ function , $ this -> model ) ) ; } return sprintf ( '%s("%s%s".%s)' , $ function , $ tablePrefix , $ table , $ column ? "\"$column\"" : '"ID"' ) ; } // Check if this column is a table on the current model $ table = $ schema -> tableForField ( $ this -> model , $ this -> name ) ; if ( $ table ) { return $ schema -> sqlColumnForField ( $ this -> model , $ this -> name , $ tablePrefix ) ; } // fallback to the provided name in the event of a joined column // name (as the candidate class doesn't check joined records) $ parts = explode ( '.' , $ this -> fullName ) ; return '"' . implode ( '"."' , $ parts ) . '"' ; }
Normalizes the field name to table mapping.

@return string
Normalizes the field name to table mapping .