TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser Class Reference

Public Member Functions

 injectDataMapper (DataMapper $dataMapper)
 
 injectEnvironmentService (EnvironmentService $environmentService)
 
 isDistinctQuerySuggested ()
 
 convertQueryToDoctrineQueryBuilder (QueryInterface $query)
 

Protected Member Functions

 initializeQueryBuilder (Qom\SourceInterface $source)
 
 parseConstraint (Qom\ConstraintInterface $constraint, Qom\SourceInterface $source)
 
 parseOrderings (array $orderings, Qom\SourceInterface $source)
 
 addTypo3Constraints (QueryInterface $query)
 
 parseComparison (Qom\ComparisonInterface $comparison, Qom\SourceInterface $source)
 
 parseDynamicOperand (Qom\ComparisonInterface $comparison, Qom\SourceInterface $source)
 
 getParameterType ($value)
 
 createTypedNamedParameter ($value, int $forceType=null)
 
 parseOperand (Qom\DynamicOperandInterface $operand, Qom\SourceInterface $source)
 
 addRecordTypeConstraint ($className)
 
 getAdditionalMatchFieldsStatement ($exprBuilder, $columnMap, $childTableAlias, $parentTable=null)
 
 getAdditionalWhereClause (QuerySettingsInterface $querySettings, $tableName, $tableAlias=null)
 
 getVisibilityConstraintStatement (QuerySettingsInterface $querySettings, $tableName, $tableAlias)
 
 getFrontendConstraintStatement ($tableName, $ignoreEnableFields, array $enableFieldsToBeIgnored=[], $includeDeleted)
 
 getBackendConstraintStatement ($tableName, $ignoreEnableFields, $includeDeleted)
 
 getSysLanguageStatement ($tableName, $tableAlias, $querySettings)
 
 getPageIdStatement ($tableName, $tableAlias, array $storagePageIds)
 
 parseJoin (Qom\JoinInterface $join, $leftTableAlias)
 
 getUniqueAlias ($tableName, $fullPropertyPath=null)
 
 addUnionStatement (&$className, &$tableName, &$propertyPath, &$fullPropertyPath)
 
 getPageRepository ()
 
 getTSFE ()
 

Protected Attributes

 $dataMapper
 
 $pageRepository
 
 $environmentService
 
 $queryBuilder
 
 $tablePropertyMap = []
 
 $tableAliasMap = []
 
 $unionTableAliasCache = []
 
 $tableName = ''
 
 $suggestDistinctQuery = false
 

Detailed Description

QueryParser, converting the qom to string representation

Definition at line 44 of file Typo3DbQueryParser.php.

Member Function Documentation

◆ addRecordTypeConstraint()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::addRecordTypeConstraint (   $className)
protected

Add a constraint to ensure that the record type of the returned tuples is matching the data type of the repository.

Parameters
string$classNameThe class name

Definition at line 572 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\initializeQueryBuilder(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseJoin().

◆ addTypo3Constraints()

◆ addUnionStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::addUnionStatement ( $className,
$tableName,
$propertyPath,
$fullPropertyPath 
)
protected

adds a union statement to the query, mostly for tables referenced in the where condition. The property for which the union statement is generated will be appended.

Parameters
string&$classNameThe name of the parent class, will be set to the child class after processing.
string&$tableNameThe name of the parent table, will be set to the table alias that is used in the union statement.
string&$propertyPathThe remaining property path, will be cut of by one part during the process.
string$fullPropertyPathThe full path the the current property, will be used to make table names unique.
Exceptions
Exception
InvalidRelationConfigurationException
MissingColumnMapException

Definition at line 951 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName, TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getAdditionalMatchFieldsStatement(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getUniqueAlias(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap\RELATION_HAS_AND_BELONGS_TO_MANY, TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap\RELATION_HAS_MANY, and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap\RELATION_HAS_ONE.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseComparison(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseOperand(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseOrderings().

◆ convertQueryToDoctrineQueryBuilder()

◆ createTypedNamedParameter()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::createTypedNamedParameter (   $value,
int  $forceType = null 
)
protected

Create a named parameter for the QueryBuilder and guess the parameter type based on the output of DataMapper::getPlainValue(). The type of the named parameter can be forced to one of the ::PARAM_* types by specifying the $forceType argument.

Parameters
mixed$valueThe input value that should be sent to the database
int | null$forceTypeThe ::PARAM_* type that should be forced
Returns
string The placeholder string to be used in the query
See also
::getPlainValue()

Definition at line 524 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getParameterType().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseDynamicOperand().

◆ getAdditionalMatchFieldsStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getAdditionalMatchFieldsStatement (   $exprBuilder,
  $columnMap,
  $childTableAlias,
  $parentTable = null 
)
protected

Builds a condition for filtering records by the configured match field, e.g. MM_match_fields, foreign_match_fields or foreign_table_field.

Parameters
ExpressionBuilder$exprBuilder
ColumnMap$columnMapThe column man for which the condition should be build.
string$childTableAliasThe alias of the child record table used in the query.
string$parentTableThe real name of the parent table (used for building the foreign_table_field condition).
Returns
string The match field conditions or an empty string.

Definition at line 614 of file Typo3DbQueryParser.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\addUnionStatement(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseComparison().

◆ getAdditionalWhereClause()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getAdditionalWhereClause ( QuerySettingsInterface  $querySettings,
  $tableName,
  $tableAlias = null 
)
protected

◆ getBackendConstraintStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getBackendConstraintStatement (   $tableName,
  $ignoreEnableFields,
  $includeDeleted 
)
protected

Returns constraint statement for backend context

Parameters
string$tableName
bool$ignoreEnableFieldsA flag indicating whether the enable fields should be ignored
bool$includeDeletedA flag indicating whether deleted records should be included
Returns
string

Definition at line 730 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName, TYPO3\CMS\Backend\Utility\BackendUtility\BEenableFields(), and TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getVisibilityConstraintStatement().

◆ getFrontendConstraintStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getFrontendConstraintStatement (   $tableName,
  $ignoreEnableFields,
array  $enableFieldsToBeIgnored = [],
  $includeDeleted 
)
protected

Returns constraint statement for frontend context

Parameters
string$tableName
bool$ignoreEnableFieldsA flag indicating whether the enable fields should be ignored
array$enableFieldsToBeIgnoredIf $ignoreEnableFields is true, this array specifies enable fields to be ignored. If it is NULL or an empty array (default) all enable fields are ignored.
bool$includeDeletedA flag indicating whether deleted records should be included
Returns
string
Exceptions
InconsistentQuerySettingsException

Definition at line 704 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName, and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getPageRepository().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getVisibilityConstraintStatement().

◆ getPageIdStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getPageIdStatement (   $tableName,
  $tableAlias,
array  $storagePageIds 
)
protected

Builds the page ID checking statement

Parameters
string$tableNameThe database table name
string$tableAliasThe table alias used in the query.
array$storagePageIdslist of storage page ids
Returns
string
Exceptions
InconsistentQuerySettingsException

Definition at line 831 of file Typo3DbQueryParser.php.

References $GLOBALS, and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getAdditionalWhereClause().

◆ getPageRepository()

◆ getParameterType()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getParameterType (   $value)
protected

Maps plain value of operand to PDO types to help Doctrine and/or the database driver process the value correctly when building the query.

Parameters
mixed$valueThe parameter value
Returns
int
Exceptions

Definition at line 498 of file Typo3DbQueryParser.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\createTypedNamedParameter().

◆ getSysLanguageStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getSysLanguageStatement (   $tableName,
  $tableAlias,
  $querySettings 
)
protected

Builds the language field statement

Parameters
string$tableNameThe database table name
string$tableAliasThe table alias used in the query.
QuerySettingsInterface$querySettingsThe TYPO3 CMS specific query settings
Returns
string

Definition at line 750 of file Typo3DbQueryParser.php.

References $GLOBALS, and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getAdditionalWhereClause().

◆ getTSFE()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getTSFE ( )
protected
Returns
TypoScriptFrontendController|null

Definition at line 1094 of file Typo3DbQueryParser.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getPageRepository().

◆ getUniqueAlias()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::getUniqueAlias (   $tableName,
  $fullPropertyPath = null 
)
protected

Generates a unique alias for the given table and the given property path. The property path will be mapped to the generated alias in the tablePropertyMap.

Parameters
string$tableNameThe name of the table for which the alias should be generated.
string$fullPropertyPathThe full property path that is related to the given table.
Returns
string The generated table alias.

Definition at line 917 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$tableName.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\addUnionStatement(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\initializeQueryBuilder(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseJoin().

◆ getVisibilityConstraintStatement()

◆ initializeQueryBuilder()

◆ injectDataMapper()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::injectDataMapper ( DataMapper  $dataMapper)
Parameters
DataMapper$dataMapper

Definition at line 108 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$dataMapper.

◆ injectEnvironmentService()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::injectEnvironmentService ( EnvironmentService  $environmentService)
Parameters
EnvironmentService$environmentService

Definition at line 116 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$environmentService.

◆ isDistinctQuerySuggested()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::isDistinctQuerySuggested ( )

Whether using a distinct query is suggested. This information is defined during parsing of the current query for RELATION_HAS_MANY & RELATION_HAS_AND_BELONGS_TO_MANY relations.

Returns
bool

Definition at line 128 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\$suggestDistinctQuery.

◆ parseComparison()

◆ parseConstraint()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::parseConstraint ( Qom\ConstraintInterface  $constraint,
Qom\SourceInterface  $source 
)
protected

Transforms a constraint into SQL and parameter arrays

Parameters
Qom\ConstraintInterface$constraintThe constraint
Qom\SourceInterface$sourceThe source
Returns
CompositeExpression|string
Exceptions

Definition at line 217 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\parseComparison().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\convertQueryToDoctrineQueryBuilder().

◆ parseDynamicOperand()

◆ parseJoin()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::parseJoin ( Qom\JoinInterface  $join,
  $leftTableAlias 
)
protected

Transforms a Join into SQL and parameter arrays

Parameters
Qom\JoinInterface$joinThe join
string$leftTableAliasThe alias from the table to main

Definition at line 874 of file Typo3DbQueryParser.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\addRecordTypeConstraint(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getUniqueAlias().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\initializeQueryBuilder().

◆ parseOperand()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::parseOperand ( Qom\DynamicOperandInterface  $operand,
Qom\SourceInterface  $source 
)
protected

◆ parseOrderings()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::parseOrderings ( array  $orderings,
Qom\SourceInterface  $source 
)
protected

Member Data Documentation

◆ $dataMapper

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$dataMapper
protected

◆ $environmentService

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$environmentService
protected

◆ $pageRepository

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$pageRepository
protected

◆ $queryBuilder

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$queryBuilder
protected

◆ $suggestDistinctQuery

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$suggestDistinctQuery = false
protected

◆ $tableAliasMap

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$tableAliasMap = []
protected

Definition at line 86 of file Typo3DbQueryParser.php.

◆ $tableName

◆ $tablePropertyMap

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$tablePropertyMap = []
protected

Definition at line 78 of file Typo3DbQueryParser.php.

◆ $unionTableAliasCache

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::$unionTableAliasCache = []
protected

Definition at line 93 of file Typo3DbQueryParser.php.