ModifyDefaultConstraintsForDatabaseQueryEvent

New in version 13.0

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 ModifyDefaultConstraintsForDatabaseQueryEvent
Fully qualified name
\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 ( )
Returns
string
getTableAlias ( )
Returns
string
getExpressionBuilder ( )
Returns
\TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
getConstraints ( )
Returns
array
setConstraints ( array $constraints)
param $constraints

the constraints

getEnableFieldsToIgnore ( )
Returns
array
getContext ( )
Returns
\TYPO3\CMS\Core\Context\Context