QueryGenerator

class \TYPO3\CMS\Core\Database\QueryGenerator

Class for generating front end for building queries

Deprecated

since v11, will be removed in v12

Table of Contents

Properties

$comp_offsets  : array
$compSQL  : array
$enablePrefix  : bool
$enableQueryParts  : bool
$extFieldLists  : array
$fieldList  : string
Field list
$fields  : array
Array of the fields possible
$lang  : array
$name  : string
Form data name prefix
$noWrap  : string
$queryConfig  : array
The query config
$table  : string
Table for the query
$tableArray  : array
$fieldName  : string
$formName  : string
$settings  : array

Methods

__construct()  : mixed
cleanInputVal()  : string
Clear input value
cleanUpQueryConfig()  : array
Clean up query config
getFormElements()  : array
Get form elements
getLabelCol()  : string
Get label column
getQuery()  : string
Get query
getQuerySingle()  : string
Get single query
getSelectQuery()  : string
Get select query
getSubscript()  : array
Get subscript
getTreeList()  : string
Recursively fetch all descendants of a given page
getUserDefQuery()  : mixed
Get user definition query
init()  : mixed
Init function
initUserDef()  : mixed
Init user definition
makeFieldList()  : string
Make a list of fields for current table
makeOptionList()  : string
Make option list
makeSelectorTable()  : string
Make selector table
mkCompSelect()  : string
Make comparison select
mkFieldToInputSelect()  : string
Make field to input select
mkOperatorSelect()  : string
Make operator select
mkTableSelect()  : string
Make table select
mkTypeSelect()  : string
Make type select
printCodeArray()  : string
Print code array
procesData()  : mixed
Process data
setAndCleanUpExternalLists()  : mixed
Set and clean up external lists
setFormName()  : mixed
Sets the current name of the input form.
updateIcon()  : string
Update icon
userDef()  : string
User definition
userDefCleanUp()  : array
User definition clean up
verifyComparison()  : int
Verify comparison
verifyType()  : string
Verify type
convertIso8601DatetimeStringToUnixTimestamp()  : array
Convert ISO-8601 timestamp (string) into unix timestamp (int)
getBackendUserAuthentication()  : BackendUserAuthentication
getDateTimePickerField()  : string
getLanguageService()  : LanguageService
isDateOfIso8601Format()  : bool
Checks if the given value is of the ISO 8601 format.
makeComparisonSelector()  : string

Properties

$comp_offsets

public array $comp_offsets = ['text' => 0, 'number' => 1, 'multiple' => 2, 'relation' => …
Show the full value['text' => 0, 'number' => 1, 'multiple' => 2, 'relation' => 2, 'date' => 3, 'time' => 3, 'boolean' => 4, 'binary' => 5]

$compSQL

public array $compSQL = [ // Type = text offset = 0 '0' => '#FIELD# LIKE \'%…
Show the full value[ // Type = text offset = 0 '0' => '#FIELD# LIKE \'%#VALUE#%\'', '1' => '#FIELD# NOT LIKE \'%#VALUE#%\'', '2' => '#FIELD# LIKE \'#VALUE#%\'', '3' => '#FIELD# NOT LIKE \'#VALUE#%\'', '4' => '#FIELD# LIKE \'%#VALUE#\'', '5' => '#FIELD# NOT LIKE \'%#VALUE#\'', '6' => '#FIELD# = \'#VALUE#\'', '7' => '#FIELD# != \'#VALUE#\'', // Type = number, offset = 32 '32' => '#FIELD# = \'#VALUE#\'', '33' => '#FIELD# != \'#VALUE#\'', '34' => '#FIELD# > #VALUE#', '35' => '#FIELD# < #VALUE#', '36' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#', '37' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)', '38' => '#FIELD# IN (#VALUE#)', '39' => '#FIELD# NOT IN (#VALUE#)', '40' => '(#FIELD# & #VALUE#)=#VALUE#', '41' => '(#FIELD# & #VALUE#)!=#VALUE#', '42' => '(#FIELD# | #VALUE#)=#VALUE#', '43' => '(#FIELD# | #VALUE#)!=#VALUE#', // Type = multiple, relation, offset = 64 '64' => '#FIELD# = \'#VALUE#\'', '65' => '#FIELD# != \'#VALUE#\'', '66' => '#FIELD# LIKE \'%#VALUE#%\' AND #FIELD# LIKE \'%#VALUE1#%\'', '67' => '(#FIELD# NOT LIKE \'%#VALUE#%\' OR #FIELD# NOT LIKE \'%#VALUE1#%\')', '68' => '#FIELD# IN (#VALUE#)', '69' => '#FIELD# NOT IN (#VALUE#)', '70' => '(#FIELD# & #VALUE#)=#VALUE#', '71' => '(#FIELD# & #VALUE#)!=#VALUE#', '72' => '(#FIELD# | #VALUE#)=#VALUE#', '73' => '(#FIELD# | #VALUE#)!=#VALUE#', // Type = date, offset = 32 '96' => '#FIELD# = \'#VALUE#\'', '97' => '#FIELD# != \'#VALUE#\'', '98' => '#FIELD# > #VALUE#', '99' => '#FIELD# < #VALUE#', '100' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#', '101' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)', '102' => '(#FIELD# & #VALUE#)=#VALUE#', '103' => '(#FIELD# & #VALUE#)!=#VALUE#', '104' => '(#FIELD# | #VALUE#)=#VALUE#', '105' => '(#FIELD# | #VALUE#)!=#VALUE#', // Type = boolean, offset = 128 '128' => '#FIELD# = \'1\'', '129' => '#FIELD# != \'1\'', // Type = binary = 160 '160' => '#FIELD# = \'#VALUE#\'', '161' => '#FIELD# != \'#VALUE#\'', '162' => '(#FIELD# & #VALUE#)=#VALUE#', '163' => '(#FIELD# & #VALUE#)=0', ]

$enablePrefix

public bool $enablePrefix = false

$enableQueryParts

public bool $enableQueryParts = false

$extFieldLists

public array $extFieldLists = []

$fieldList

Field list

public string $fieldList

$fields

Array of the fields possible

public array $fields = []

$lang

public array $lang = ['OR' => 'or', 'AND' => 'and', 'comparison' => [ // Type…
Show the full value['OR' => 'or', 'AND' => 'and', 'comparison' => [ // Type = text offset = 0 '0_' => 'contains', '1_' => 'does not contain', '2_' => 'starts with', '3_' => 'does not start with', '4_' => 'ends with', '5_' => 'does not end with', '6_' => 'equals', '7_' => 'does not equal', // Type = number , offset = 32 '32_' => 'equals', '33_' => 'does not equal', '34_' => 'is greater than', '35_' => 'is less than', '36_' => 'is between', '37_' => 'is not between', '38_' => 'is in list', '39_' => 'is not in list', '40_' => 'binary AND equals', '41_' => 'binary AND does not equal', '42_' => 'binary OR equals', '43_' => 'binary OR does not equal', // Type = multiple, relation, offset = 64 '64_' => 'equals', '65_' => 'does not equal', '66_' => 'contains', '67_' => 'does not contain', '68_' => 'is in list', '69_' => 'is not in list', '70_' => 'binary AND equals', '71_' => 'binary AND does not equal', '72_' => 'binary OR equals', '73_' => 'binary OR does not equal', // Type = date,time offset = 96 '96_' => 'equals', '97_' => 'does not equal', '98_' => 'is greater than', '99_' => 'is less than', '100_' => 'is between', '101_' => 'is not between', '102_' => 'binary AND equals', '103_' => 'binary AND does not equal', '104_' => 'binary OR equals', '105_' => 'binary OR does not equal', // Type = boolean, offset = 128 '128_' => 'is True', '129_' => 'is False', // Type = binary , offset = 160 '160_' => 'equals', '161_' => 'does not equal', '162_' => 'contains', '163_' => 'does not contain', ]]

$name

Form data name prefix

public string $name

$queryConfig

The query config

public array $queryConfig = []

$table

Table for the query

public string $table

$settings

protected array $settings = []

Settings, usually from the controller, previously known as MOD_SETTINGS

Methods

cleanInputVal()

Clear input value

public cleanInputVal(array $conf[, string $suffix = '' ]) : string

Parameters

$conf : array
$suffix : string = ''

Return values

string

cleanUpQueryConfig()

Clean up query config

public cleanUpQueryConfig(array $queryConfig) : array

Parameters

$queryConfig : array

Query config

Return values

array

getFormElements()

Get form elements

public getFormElements([int $subLevel = 0 ][, string $queryConfig = '' ][, string $parent = '' ]) : array

Parameters

$subLevel : int = 0
$queryConfig : string = ''
$parent : string = ''

Return values

array

getLabelCol()

Get label column

public getLabelCol() : string

Return values

string

getQuery()

Get query

public getQuery(array $queryConfig[, string $pad = '' ]) : string

Parameters

$queryConfig : array
$pad : string = ''

Return values

string

getQuerySingle()

Get single query

public getQuerySingle(array $conf, bool $first) : string

Parameters

$conf : array
$first : bool

Return values

string

getSelectQuery()

Get select query

public getSelectQuery([string $qString = '' ]) : string

Parameters

$qString : string = ''

Return values

string

getSubscript()

Get subscript

public getSubscript(array $arr) : array

Parameters

$arr : array

Return values

array

getTreeList()

Recursively fetch all descendants of a given page

public getTreeList(int $id, int $depth[, int $begin = 0 ][, string $permClause = '' ]) : string

Parameters

$id : int

uid of the page

$depth : int
$begin : int = 0
$permClause : string = ''

Return values

string —

comma separated list of descendant pages

getUserDefQuery()

Get user definition query

public getUserDefQuery(array $qcArr, bool $first) : mixed

Parameters

$qcArr : array
$first : bool

init()

Init function

public init(string $name, string $table[, string $fieldList = '' ][, array $settings = [] ]) : mixed

Parameters

$name : string

The name

$table : string

The table name

$fieldList : string = ''

The field list

$settings : array = []

Module settings like checkboxes in the interface

initUserDef()

Init user definition

public initUserDef() : mixed

makeFieldList()

Make a list of fields for current table

public makeFieldList() : string

Return values

string —

Separated list of fields

makeOptionList()

Make option list

public makeOptionList(string $fieldName, array $conf, string $table) : string

Parameters

$fieldName : string
$conf : array
$table : string

Return values

string

makeSelectorTable()

Make selector table

public makeSelectorTable(array $modSettings[, string $enableList = 'table,fields,query,group,order,limit' ]) : string

Parameters

$modSettings : array
$enableList : string = 'table,fields,query,group,order,limit'

Return values

string

mkCompSelect()

Make comparison select

public mkCompSelect(string $name, string $comparison, int $neg) : string

Parameters

$name : string
$comparison : string
$neg : int

Return values

string

mkFieldToInputSelect()

Make field to input select

public mkFieldToInputSelect(string $name, string $fieldName) : string

Parameters

$name : string
$fieldName : string

Return values

string

mkOperatorSelect()

Make operator select

public mkOperatorSelect(string $name, string $op, bool $draw, bool $submit) : string

Parameters

$name : string
$op : string
$draw : bool
$submit : bool

Return values

string

mkTableSelect()

Make table select

public mkTableSelect(string $name, string $cur) : string

Parameters

$name : string
$cur : string

Return values

string

mkTypeSelect()

Make type select

public mkTypeSelect(string $name, string $fieldName[, string $prepend = 'FIELD_' ]) : string

Parameters

$name : string
$fieldName : string
$prepend : string = 'FIELD_'

Return values

string

printCodeArray()

Print code array

public printCodeArray(array $codeArr[, int $recursionLevel = 0 ]) : string

Parameters

$codeArr : array
$recursionLevel : int = 0

Return values

string

procesData()

Process data

public procesData([array $qC = [] ]) : mixed

Parameters

$qC : array = []

Query config

setAndCleanUpExternalLists()

Set and clean up external lists

public setAndCleanUpExternalLists(string $name, string $list[, string $force = '' ]) : mixed

Parameters

$name : string

The name

$list : string

The list

$force : string = ''

setFormName()

Sets the current name of the input form.

public setFormName(string $formName) : mixed

Parameters

$formName : string

The name of the form.

updateIcon()

Update icon

public updateIcon() : string

Return values

string

userDef()

User definition

public userDef(string $fieldPrefix, array $conf, string $fieldName, string $fieldType) : string

Parameters

$fieldPrefix : string
$conf : array
$fieldName : string
$fieldType : string

Return values

string

userDefCleanUp()

User definition clean up

public userDefCleanUp(array $queryConfig) : array

Parameters

$queryConfig : array

Return values

array

verifyComparison()

Verify comparison

public verifyComparison(string $comparison, int $neg) : int

Parameters

$comparison : string
$neg : int

Return values

int

verifyType()

Verify type

public verifyType(string $fieldName) : string

Parameters

$fieldName : string

Return values

string

convertIso8601DatetimeStringToUnixTimestamp()

Convert ISO-8601 timestamp (string) into unix timestamp (int)

protected convertIso8601DatetimeStringToUnixTimestamp(array $conf) : array

Parameters

$conf : array

Return values

array

getDateTimePickerField()

protected getDateTimePickerField(string $name, string $timestamp, string $type) : string

Parameters

$name : string

the field name

$timestamp : string

ISO-8601 timestamp

$type : string

[datetime, date, time, timesec, year]

Return values

string

isDateOfIso8601Format()

Checks if the given value is of the ISO 8601 format.

protected isDateOfIso8601Format(mixed $date) : bool

Parameters

$date : mixed

Return values

bool

makeComparisonSelector()

protected makeComparisonSelector(string $subscript, string $fieldName, array $conf) : string

Parameters

$subscript : string
$fieldName : string
$conf : array

Return values

string
On this page