DefaultRestrictionContainer extends AbstractRestrictionContainer
This is the container with restrictions, that are added to any doctrine query
Table of Contents
Properties
- $defaultRestrictionTypes : array<string|int, string>
- Default restriction classes.
- $enforcedRestrictions : array<string|int, QueryRestrictionInterface>
- $restrictions : array<string|int, QueryRestrictionInterface>
Methods
- __construct() : mixed
- Creates instances of the registered default restriction classes
- add() : QueryRestrictionContainerInterface
- Add a new restriction instance to this collection
- buildExpression() : CompositeExpression
- Main method to build expressions for given tables.
- removeAll() : QueryRestrictionContainerInterface
- Removes all restrictions stored within this container
- removeByType() : QueryRestrictionContainerInterface
- Remove restriction of a given type
- createRestriction() : QueryRestrictionInterface
- Factory method for restrictions.
Properties
$defaultRestrictionTypes
Default restriction classes.
protected
array<string|int, string>
$defaultRestrictionTypes
= [\TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction::class, \TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction::class, \TYPO3\CMS\Core\Database\Query\Restriction\StartTimeRestriction::class, \TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction::class]
$enforcedRestrictions
protected
array<string|int, QueryRestrictionInterface>
$enforcedRestrictions
= []
$restrictions
protected
array<string|int, QueryRestrictionInterface>
$restrictions
= []
Methods
__construct()
Creates instances of the registered default restriction classes
public
__construct() : mixed
add()
Add a new restriction instance to this collection
public
add(QueryRestrictionInterface $restriction) : QueryRestrictionContainerInterface
Parameters
- $restriction : QueryRestrictionInterface
Return values
QueryRestrictionContainerInterfacebuildExpression()
Main method to build expressions for given tables.
public
buildExpression(array<string|int, mixed> $queriedTables, ExpressionBuilder $expressionBuilder) : CompositeExpression
Iterating over all registered expressions and combine them with AND
Parameters
- $queriedTables : array<string|int, mixed>
-
Array of tables, where array key is table alias and value is a table name
- $expressionBuilder : ExpressionBuilder
-
Expression builder instance to add restrictions with
Return values
CompositeExpression —The result of query builder expression(s)
removeAll()
Removes all restrictions stored within this container
public
removeAll() : QueryRestrictionContainerInterface
Return values
QueryRestrictionContainerInterfaceremoveByType()
Remove restriction of a given type
public
removeByType(string $restrictionType) : QueryRestrictionContainerInterface
Parameters
- $restrictionType : string
-
Class name of the restriction to be removed
Return values
QueryRestrictionContainerInterfacecreateRestriction()
Factory method for restrictions.
protected
createRestriction(string $restrictionClass) : QueryRestrictionInterface
Currently only instantiates the class.
Parameters
- $restrictionClass : string