Typo3QuerySettings implements QuerySettingsInterface

Query settings, reflects the settings unique to TYPO3 CMS.

The settings stored in this class are used by Extbase's persistence layer to control which data is retrieved from the database. It is possible for each Query to have a dedicated Typo3QuerySettings object, but those settings are not adhered to when reconstituting relations of entity objects. There a completely new Typo3QuerySettings object is used, with default settings applied. While this alone already may cause unexpected behavior, it is even worse when considering the contexts of TYPO3: Frontend, backend and CLI. Due to the nature of TYPO3, the enable-fields must be ignored in backend context, as an editor needs to see all records, regardless whether those are publicly (frontend) visible or not. This class has therefore the responsitiblity to provide different defaults, depending on the context. Unfortunately, the only way to determine the current context is by relying on the global request object.

Tags
todo:

Future improvements should split this class into dedicated classes for backend, frontend (and possibly CLI) context. Furthermore, it must be re-evaluated if the object reconstitution within DataMapper should actually inherit the query settings the initial query was based upon.

Attributes
#[Autoconfigure]
$public: true
$shared: false

Table of Contents

Interfaces

QuerySettingsInterface
A query settings interface. This interface is NOT part of the TYPO3.Flow API.

Properties

$configurationManager  : ConfigurationManagerInterface
$context  : Context
$enableFieldsToBeIgnored  : array<string|int, mixed>
An array of column names in the enable columns array (array keys in $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']), to be ignored while building the query statement
$ignoreEnableFields  : bool
A flag indicating whether all or some enable fields should be ignored. If TRUE, all enable fields are ignored.
$includeDeleted  : bool
Flag whether deleted records should be included in the result set.
$languageAspect  : LanguageAspect
$respectStoragePage  : bool
Flag if the storage page should be respected for the query.
$respectSysLanguage  : bool
Flag if the sys_language_uid should be respected (default is TRUE).
$storagePageIds  : array<string|int, mixed>
the pid(s) of the storage page(s) that should be respected for the query.

Methods

__construct()  : mixed
getEnableFieldsToBeIgnored()  : array<string|int, string>
An array of column names in the enable columns array (array keys in $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']), to be ignored while building the query statement.
getIgnoreEnableFields()  : bool
The returned value indicates whether all or some enable fields should be ignored.
getIncludeDeleted()  : bool
Returns if the query should return objects that are deleted.
getLanguageAspect()  : LanguageAspect
getRespectStoragePage()  : bool
Returns the state, if the storage page should be respected for the query.
getRespectSysLanguage()  : bool
Returns the state, if record language should be checked when querying
getStoragePageIds()  : array<string|int, mixed>
Returns the pid(s) of the storage page(s) that should be respected for the query.
setEnableFieldsToBeIgnored()  : $this
An array of column names in the enable columns array (array keys in $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']), to be ignored while building the query statement. Adding a column name here effectively switches off filtering by this column. This setting is only taken into account if $this->ignoreEnableFields = TRUE.
setIgnoreEnableFields()  : $this
Sets a flag indicating whether all or some enable fields should be ignored. If TRUE, all enable fields are ignored.
setIncludeDeleted()  : $this
Sets the flag if the query should return objects that are deleted.
setLanguageAspect()  : $this
Overrides the main language aspect, defined in the main Context API
setRespectStoragePage()  : $this
Sets the flag if the storage page should be respected for the query.
setRespectSysLanguage()  : $this
Sets the flag if record language should be respected when querying.
setStoragePageIds()  : $this
Sets the pid(s) of the storage page(s) that should be respected for the query.

Properties

$enableFieldsToBeIgnored

An array of column names in the enable columns array (array keys in $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']), to be ignored while building the query statement

protected array<string|int, mixed> $enableFieldsToBeIgnored = []

$ignoreEnableFields

A flag indicating whether all or some enable fields should be ignored. If TRUE, all enable fields are ignored.

protected bool $ignoreEnableFields = false

If--in addition to this--enableFieldsToBeIgnored is set, only fields specified there are ignored. If FALSE, all enable fields are taken into account, regardless of the enableFieldsToBeIgnored setting.

$includeDeleted

Flag whether deleted records should be included in the result set.

protected bool $includeDeleted = false

$respectStoragePage

Flag if the storage page should be respected for the query.

protected bool $respectStoragePage = true

$respectSysLanguage

Flag if the sys_language_uid should be respected (default is TRUE).

protected bool $respectSysLanguage = true

$storagePageIds

the pid(s) of the storage page(s) that should be respected for the query.

protected array<string|int, mixed> $storagePageIds = []

Methods

getEnableFieldsToBeIgnored()

An array of column names in the enable columns array (array keys in $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']), to be ignored while building the query statement.

public getEnableFieldsToBeIgnored() : array<string|int, string>
Tags
see
getIgnoreEnableFields()
Return values
array<string|int, string>

getIgnoreEnableFields()

The returned value indicates whether all or some enable fields should be ignored.

public getIgnoreEnableFields() : bool

If TRUE, all enable fields are ignored. If--in addition to this--enableFieldsToBeIgnored is set, only fields specified there are ignored. If FALSE, all enable fields are taken into account, regardless of the enableFieldsToBeIgnored setting.

Tags
see
getEnableFieldsToBeIgnored()
Return values
bool

getIncludeDeleted()

Returns if the query should return objects that are deleted.

public getIncludeDeleted() : bool
Return values
bool

getRespectStoragePage()

Returns the state, if the storage page should be respected for the query.

public getRespectStoragePage() : bool
Return values
bool

TRUE, if the storage page should be respected; otherwise FALSE.

getRespectSysLanguage()

Returns the state, if record language should be checked when querying

public getRespectSysLanguage() : bool
Return values
bool

TRUE if TYPO3 language settings are to be applied

getStoragePageIds()

Returns the pid(s) of the storage page(s) that should be respected for the query.

public getStoragePageIds() : array<string|int, mixed>
Return values
array<string|int, mixed>

list of integers that each represent a storage page id

setEnableFieldsToBeIgnored()

An array of column names in the enable columns array (array keys in $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']), to be ignored while building the query statement. Adding a column name here effectively switches off filtering by this column. This setting is only taken into account if $this->ignoreEnableFields = TRUE.

public setEnableFieldsToBeIgnored(array<string|int, mixed> $enableFieldsToBeIgnored) : $this
Parameters
$enableFieldsToBeIgnored : array<string|int, mixed>
Tags
see
setIgnoreEnableFields()
Return values
$this

fluent interface

setIgnoreEnableFields()

Sets a flag indicating whether all or some enable fields should be ignored. If TRUE, all enable fields are ignored.

public setIgnoreEnableFields(bool $ignoreEnableFields) : $this

If--in addition to this--enableFieldsToBeIgnored is set, only fields specified there are ignored. If FALSE, all enable fields are taken into account, regardless of the enableFieldsToBeIgnored setting.

Parameters
$ignoreEnableFields : bool
Tags
see
setEnableFieldsToBeIgnored()
Return values
$this

fluent interface

setIncludeDeleted()

Sets the flag if the query should return objects that are deleted.

public setIncludeDeleted(bool $includeDeleted) : $this
Parameters
$includeDeleted : bool
Return values
$this

fluent interface

setLanguageAspect()

Overrides the main language aspect, defined in the main Context API

public setLanguageAspect(LanguageAspect $languageAspect) : $this
Parameters
$languageAspect : LanguageAspect
Return values
$this

fluent interface

setRespectStoragePage()

Sets the flag if the storage page should be respected for the query.

public setRespectStoragePage(bool $respectStoragePage) : $this
Parameters
$respectStoragePage : bool

If TRUE the storage page ID will be determined and the statement will be extended accordingly.

Return values
$this

fluent interface

setRespectSysLanguage()

Sets the flag if record language should be respected when querying.

public setRespectSysLanguage(bool $respectSysLanguage) : $this
Parameters
$respectSysLanguage : bool

TRUE if TYPO3 language settings are to be applied

Return values
$this

fluent interface

setStoragePageIds()

Sets the pid(s) of the storage page(s) that should be respected for the query.

public setStoragePageIds(array<string|int, mixed> $storagePageIds) : $this
Parameters
$storagePageIds : array<string|int, mixed>

If given the storage page IDs will be determined and the statement will be extended accordingly.

Return values
$this

fluent interface

On this page

Search results