‪TYPO3CMS  10.4
TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction Class Reference
Inheritance diagram for TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction:
TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface

Public Member Functions

 __construct (int $workspaceId=0)
 
CompositeExpression buildExpression (array $queriedTables, ExpressionBuilder $expressionBuilder)
 

Protected Attributes

int $workspaceId
 

Detailed Description

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

Definition at line 38 of file WorkspaceRestriction.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction::__construct ( int  $workspaceId = 0)
Parameters
int$workspaceId

Definition at line 47 of file WorkspaceRestriction.php.

References TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction\$workspaceId.

Member Function Documentation

◆ buildExpression()

CompositeExpression TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction::buildExpression ( array  $queriedTables,
ExpressionBuilder  $expressionBuilder 
)

Main method to build expressions for given tables

Parameters
array$queriedTables‪Array of tables, where array key is table alias and value is a table name
ExpressionBuilder$expressionBuilderExpression builder instance to add restrictions with
Returns
‪CompositeExpression The result of query builder expression(s)

Implements TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface.

Definition at line 59 of file WorkspaceRestriction.php.

References $GLOBALS, TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder\andX(), TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder\eq(), and TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder\in().

Member Data Documentation

◆ $workspaceId

int TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction::$workspaceId
protected