com\setasign\Konquadrat\Object\Database

ObjectSelect Class Query Select

File: /Konquadrat/src/Object/Database/ObjectSelect.php

Class hierarchy

Implements

Summary

Properties

$ignoreShowDeletedFlag

$includeAllFields

$includeTypeFilter

$joinedTables

private ObjectSelect::$joinedTables = array(...)

$languageManager

$mainTable

$objectConfig

$objectFinder

$parts

Contains the single parts of the statement

$selectFields

private ObjectSelect::$selectFields = array(...)

$type

$unjoinedTables


Methods

__construct()

public ObjectSelect::__construct (
string|array|\com\setasign\SetaFramework\Database\ExpressionInterface $objectConfig,
\com\setasign\Konquadrat\Object\ObjectFinder $objectFinder,
\com\setasign\Konquadrat\LanguageManager $languageManager,
string $type,
bool $ignoreShowDeletedFlag = false,
?string $priorityTable = null
)

Constructor

Parameters
$objectConfig: string|array|\com\setasign\SetaFramework\Database\ExpressionInterface
 
$objectFinder: \com\setasign\Konquadrat\Object\ObjectFinder
 
$languageManager: \com\setasign\Konquadrat\LanguageManager
 
$type: string
 
$ignoreShowDeletedFlag: bool
 
$priorityTable: ?string
 

addFilter()

protected \com\setasign\SetaFramework\Database\Query\AbstractQuery::addFilter (
array &$part,
string $logic,
string|\Closure $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Add a filter to a specific part

$statementOrColumn can be a Closure if $operator isn't set. The Closure will be called with (AbstractQuery $query, Database $quoteInterface) and has no return. $query won't be inserted directly, only the added parts of type $part will be used and set in parentheses.

Parameters
$part: array
 
$logic: string

Logic operator like "OR" or "AND" or "XOR", not important if this is the first element of a part

$statementOrColumn: string|\Closure
 
$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as a value.

addOn()

protected \com\setasign\SetaFramework\Database\Query\AbstractQuery::addOn (
string $logic,
string|\Closure $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Adds a on-block to last added join

Parameters
$logic: string

Logic operator like "OR" or "AND", not important if this is the first element of a part

$statementOrColumn: string|\Closure
 
$operator: ?string
 
$compareValue: mixed
 
Exceptions

Throws \BadMethodCallException

distinct()

Parameters
$distinct: bool
 

ensureTableJoin()

private ObjectSelect::ensureTableJoin (
string $tableName
): void
Parameters
$tableName: string
 

from()

public \com\setasign\SetaFramework\Database\Query\Select::from (
string|array|true ...$tables
): static

Add selected table(s)

The method has no defined count of max arguments. Every param means one table to select from:

If a param is not an array it's simply the tablename without an alias

If a param is an array, the first entry will be the table and second the alias. The first entry can be a string, a Select-Object or a Closure (params: Database\Select $select, QuoteInterface $quoteInterface). The second entry need to be a string. Remember: When you use a Select-Object or Closure your Database need to support subqueries.

Normally the tables will be merged to all existing from-tables except the last param is an boolean TRUE.

Parameters
$tables: string|array|true
 

getPart()

Returns the defined part

Parameters
$part: string
 

getSql()

Returns the query as string

Parameters
$quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
 

getSqlColumns()

getSqlFrom()

getSqlGroupBy()

getSqlHaving()

getSqlJoin()

getSqlLimit()

getSqlLock()

getSqlOrderBy()

getSqlWhere()

groupBy()

Adds group-by column(s)

The column(s) will be merged to all existing group-by columns

Parameters
$columns: string|array
 

hasPart()

Parameters
$part: string
 

having()

public \com\setasign\SetaFramework\Database\Query\Select::having (
string|\Closure $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Adds a HAVING-AND-condition to query

Parameters
$statementOrColumn: string|\Closure
 
$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as a value.

havingOr()

public \com\setasign\SetaFramework\Database\Query\Select::havingOr (
string|\Closure $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Adds a HAVING-OR-condition to query

Parameters
$statementOrColumn: string|\Closure
 
$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as a value.

havingOrParentheseOpen()

Starts an HAVING-OR-condition-block in parentheses

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT

havingParentheseClose()

Ends the last condition-block in parentheses

havingParentheseOpen()

Starts an HAVING-AND-condition-block in parentheses

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT

join()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::join (
string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure $table,
string $joinType = '',
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
): static

Adds a join to query

Parameters
$table: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure

By default, this will be quoted as an identifier.

$joinType: string
 
$indexHintList: \com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[]
 

joinInner()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::joinInner (
string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure $table,
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
): static

Adds an inner-join to query

Parameters
$table: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure

By default, this will be quoted as an identifier.

$indexHintList: \com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[]
 

joinLeft()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::joinLeft (
string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure $table,
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
): static

Adds a left-outer-join to query

Parameters
$table: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure

By default, this will be quoted as an identifier.

$indexHintList: \com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[]
 

joinRight()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::joinRight (
string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure $table,
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
): static

Adds a right-outer-join to query

Parameters
$table: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure

By default, this will be quoted as an identifier.

$indexHintList: \com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[]
 

joinStraight()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::joinStraight (
string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure $table,
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
): static

Adds a straight-join to query

Parameters
$table: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure

By default, this will be quoted as an identifier.

$indexHintList: \com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[]
 

limit()

public \com\setasign\SetaFramework\Database\Query\Select::limit (
int $limit,
?int $offset = null
): static

Sets a limit for query

Parameters
$limit: int
 
$offset: ?int
 

on()

Adds a ON-AND-condition to last added join

Parameters
$statementOrColumn: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface

By default, this will be quoted as an identifier.

$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as an identifier.

Exceptions

Throws \BadMethodCallException

onOr()

Adds a ON-OR-condition to last added join

Parameters
$statementOrColumn: string|array|\com\setasign\SetaFramework\Database\Query\Select|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface

By default, this will be quoted as an identifier.

$operator: ?string
 
$compareValue: ?string

By default, this will be quoted as an identifier.

onOrParentheseOpen()

Starts a ON-OR-condition-block in parentheses to last added join

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT

onParentheseClose()

Ends the last on-condition-block in parentheses

onParentheseOpen()

Starts a ON-AND-condition-block in parentheses to last added join

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT

orderBy()

processFilter()

Parses a single part to string

Parameters
$parts: array
 
$quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
 
$mainPart: string
 
Exceptions

Throws \InvalidArgumentException

reset()

Resets a single part or all parts of the statement

Parameters
$part: ?string
 

resolveColumn()

Resolves a field name to the associated database query to fetch the value of the field. This method can resolve reference fields and magic fields.

Parameters
$fieldName: string
 

select()

Add selected column(s)

If this method will be called more than once the selected columns will be merged if $overwrite is false

Parameters
$columns: string|array|\com\setasign\SetaFramework\Database\ExpressionInterface
 
$overwrite: bool
 

selectField()

public ObjectSelect::selectField (
string $fieldName,
?string $alias = null
): string
Parameters
$fieldName: string
 
$alias: ?string
 

where()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::where (
string|int|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Adds a WHERE-AND-condition to where part

Parameters
$statementOrColumn: string|int|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface

By default, quoted as an identifier.

$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as a value.

whereOr()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::whereOr (
string|int|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Adds a WHERE-OR-condition to where part

Parameters
$statementOrColumn: string|int|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface

By default, quoted as an identifier.

$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as a value.

whereOrParentheseOpen()

Starts an WHERE-OR-condition-block in parentheses

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT

whereParentheseClose()

Ends the last condition-block in parentheses

whereParentheseOpen()

Starts an WHERE-AND-condition-block in parentheses

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT

whereXor()

public \com\setasign\SetaFramework\Database\Query\AbstractQuery::whereXor (
string|int|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
): static

Adds a WHERE-XOR-condition to where part

Parameters
$statementOrColumn: string|int|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface

By default, quoted as an identifier.

$operator: ?string
 
$compareValue: mixed

By default, this will be quoted as a value.

whereXorParentheseOpen()

Starts an WHERE-XOR-condition-block in parentheses

There is no autoclosing of parentheses.

Parameters
$reverse: bool

Reverse result of parenthese with prefix NOT