ModifyDefaultConstraintsForDatabaseQueryEvent

New in version 13.0

This event serves as a replacement for the removed hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'].

The API class \TYPO3\CMS\Core\Domain\Repository\PageRepository has a method getDefaultConstraints() which accumulates common restrictions for a database query. The purpose is to limit queries for TCA-based tables, filtering out disabled or scheduled records.

The PSR-14 event \TYPO3\CMS\Core\Domain\Event\ModifyDefaultConstraintsForDatabaseQueryEvent allows to remove, alter or add constraints compiled by TYPO3 for a specific table to further limit these constraints.

The event contains a list of CompositeExpression objects, allowing to modify them via the getConstraints() and setConstraints(array $constraints) methods.

Example

API

class \TYPO3\CMS\Core\Domain\Event\ ModifyDefaultConstraintsForDatabaseQueryEvent

Event which is fired when compiling the list of constraints such as "deleted" and "starttime", "endtime" etc.

This Event allows for additional enableColumns to be added or removed to the list of constraints.

An example: The extension ingmar_accessctrl enables assigning more than one usergroup to content and page records

getTable ( )
returntype

string

getTableAlias ( )
returntype

string

getExpressionBuilder ( )
returntype

TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder

getConstraints ( )
returntype

array

setConstraints ( array $constraints)
param array $constraints

the constraints

getEnableFieldsToIgnore ( )
returntype

array

getContext ( )
returntype

TYPO3\CMS\Core\Context\Context