com\setasign\Konquadrat\Object\Database
ObjectSelect Class Query Select
File: /Konquadrat/src/Object/Database/ObjectSelect.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- addFilter()
- addOn()
- distinct()
- ensureTableJoin()
- forShare()
- forShareNoWait()
- forUpdate()
- forUpdateNoWait()
- from()
- getPart()
- getSql()
- getSqlColumns()
- getSqlFrom()
- getSqlGroupBy()
- getSqlHaving()
- getSqlJoin()
- getSqlLimit()
- getSqlLock()
- getSqlOrderBy()
- getSqlWhere()
- getSqlWith()
- groupBy()
- hasPart()
- having()
- havingOr()
- havingOrParentheseOpen()
- havingParentheseClose()
- havingParentheseOpen()
- join()
- joinInner()
- joinLeft()
- joinRight()
- joinStraight()
- limit()
- on()
- onOr()
- onOrParentheseOpen()
- onParentheseClose()
- onParentheseOpen()
- orderBy()
- processFilter()
- reset()
- resolveColumn()
- select()
- selectField()
- where()
- whereOr()
- whereOrParentheseOpen()
- whereParentheseClose()
- whereParentheseOpen()
- whereXor()
- whereXorParentheseOpen()
- with()
- withRecursive()
Properties
$ignoreShowDeletedFlag
$includeAllFields
$includeTypeFilter
$joinedTables
$languageManager
$mainTable
$objectConfig
$objectFinder
$selectFields
$type
$unjoinedTables
Methods
__construct()
\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()
string $logic,
string|\Closure $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
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()
string|\Closure $statementOrColumn,
?string $operator = null,
mixed $compareValue = null
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
from()
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
getSql()
Returns the query as string
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlColumns()
Parses content of select-part
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlFrom()
Parses the from-block to string
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlGroupBy()
Parses content of group-by part
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlHaving()
Parses content of having-part
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlJoin()
Parses the join block to string
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlLimit()
Parses the limit block to string
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlOrderBy()
Parses the orderBy block to string
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlWhere()
Parses the where block to string
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
getSqlWith()
Parameters
- $quoteInterface: \com\setasign\SetaFramework\Database\QuoteInterface
groupBy()
Adds group-by column(s)
The column(s) will be merged to all existing group-by columns
Parameters
- $columns: string|array
having()
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()
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
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()
string $joinType = '',
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
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()
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
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()
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
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()
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
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()
\com\setasign\SetaFramework\Database\Query\IndexHintList|\com\setasign\SetaFramework\Database\Query\IndexHintList[] $indexHintList = array ( )
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()
?int $offset = null
Sets a limit for query
Parameters
- $limit: int
- $offset: ?int
on()
?string $operator = null,
mixed $compareValue = null
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()
?string $operator = null,
?string $compareValue = null
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
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()
string $direction = 'ASC'
Adds an order-by-column to query
Parameters
- $column: string|\com\setasign\SetaFramework\Database\Query\Select|\Closure|\com\setasign\SetaFramework\Database\ExpressionInterface
By default, quoted as an identifier.
- $direction: string
'ASC' or 'DESC'
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()
bool $overwrite = false
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
where()
?string $operator = null,
mixed $compareValue = null
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()
?string $operator = null,
mixed $compareValue = null
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()
?string $operator = null,
mixed $compareValue = null
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
with()
\com\setasign\SetaFramework\Database\Query\Select|\com\setasign\SetaFramework\Database\Query\Union|\Closure|string $query
Parameters
- $name: string
- $query: \com\setasign\SetaFramework\Database\Query\Select|\com\setasign\SetaFramework\Database\Query\Union|\Closure|string
withRecursive()
\com\setasign\SetaFramework\Database\Query\Select|\com\setasign\SetaFramework\Database\Query\Union|\Closure|string $query
Parameters
- $name: string
- $query: \com\setasign\SetaFramework\Database\Query\Select|\com\setasign\SetaFramework\Database\Query\Union|\Closure|string
