WorkspaceRestriction implements QueryRestrictionInterface
Restriction to make queries workspace-aware. This restriction is new compared to the "older" FrontendWorkspaceRestriction and BackendWorkspaceRestriction in a way that it ALWAYS fetches the live version, plus in current workspace the workspace records).
It does not care about the state, as this should be done by overlays.
As workspaces cannot be fully overlaid within ONE query, this query does the following:
- In live context, only fetch published records
- In a workspace, fetch all LIVE records and all workspace records which do not have "1" (= all new placeholders get fetched as well)
This means, that all records which are fetched need to run through either
- BackendUtility::getRecordWSOL() (when having one or a few records)
- PageRepository->versionOL()
- PlainDataResolver (when having lots of records)
Table of Contents
Interfaces
- QueryRestrictionInterface
- The main restriction interface. All restrictions (including the collections) must implement this.
Properties
- $includeAllVersionedRecords : bool
- Used to also query records within a workspace, which is useful for DB queries that check for a specific field (e.g. "slug") which might have changed within a workspace.
- $workspaceId : int
Methods
- __construct() : mixed
- buildExpression() : CompositeExpression
- Main method to build expressions for given tables
Properties
$includeAllVersionedRecords
Used to also query records within a workspace, which is useful for DB queries that check for a specific field (e.g. "slug") which might have changed within a workspace.
protected
bool
$includeAllVersionedRecords
Please note that some duplicates might be shown and the "reduce" logic needs to be added after querying. Setting this flag might also be a problem when using the DB query with limit and offset settings.
$workspaceId
protected
int
$workspaceId
Methods
__construct()
public
__construct([int $workspaceId = 0 ][, bool $includeAllVersionedRecords = false ]) : mixed
Parameters
- $workspaceId : int = 0
- $includeAllVersionedRecords : bool = false
buildExpression()
Main method to build expressions for given tables
public
buildExpression(array<string|int, mixed> $queriedTables, ExpressionBuilder $expressionBuilder) : CompositeExpression
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)