TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Persistence\Generic\Query Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Generic\Query:
TYPO3\CMS\Extbase\Persistence\QueryInterface Tx_Extbase_Persistence_Query

Public Member Functions

 __construct ($type)
 
 setQuerySettings (QuerySettingsInterface $querySettings)
 
 getQuerySettings ()
 
 getType ()
 
 setSource (\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source)
 
 getSource ()
 
 execute ($returnRawQueryResult=FALSE)
 
 setOrderings (array $orderings)
 
 getOrderings ()
 
 setLimit ($limit)
 
 unsetLimit ()
 
 getLimit ()
 
 setOffset ($offset)
 
 getOffset ()
 
 matching ($constraint)
 
 statement ($statement, array $parameters=array())
 
 getStatement ()
 
 getConstraint ()
 
 logicalAnd ($constraint1)
 
 logicalOr ($constraint1)
 
 logicalNot (\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint)
 
 equals ($propertyName, $operand, $caseSensitive=TRUE)
 
 like ($propertyName, $operand, $caseSensitive=TRUE)
 
 contains ($propertyName, $operand)
 
 in ($propertyName, $operand)
 
 lessThan ($propertyName, $operand)
 
 lessThanOrEqual ($propertyName, $operand)
 
 greaterThan ($propertyName, $operand)
 
 greaterThanOrEqual ($propertyName, $operand)
 
 __wakeup ()
 
 __sleep ()
 
 count ()
 
 isEmpty ($propertyName)
 
- Public Member Functions inherited from TYPO3\CMS\Extbase\Persistence\QueryInterface
 setQuerySettings (Generic\QuerySettingsInterface $querySettings)
 
 setSource (Generic\Qom\SourceInterface $source)
 

Public Attributes

const JCR_JOIN_TYPE_INNER = '{http://www.jcp.org/jcr/1.0}joinTypeInner'
 
const JCR_JOIN_TYPE_LEFT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeLeftOuter'
 
const JCR_JOIN_TYPE_RIGHT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeRightOuter'
 
const CHARSET = 'utf-8'
 
- Public Attributes inherited from TYPO3\CMS\Extbase\Persistence\QueryInterface
const OPERATOR_EQUAL_TO = 1
 
const OPERATOR_EQUAL_TO_NULL = 101
 
const OPERATOR_NOT_EQUAL_TO = 2
 
const OPERATOR_NOT_EQUAL_TO_NULL = 202
 
const OPERATOR_LESS_THAN = 3
 
const OPERATOR_LESS_THAN_OR_EQUAL_TO = 4
 
const OPERATOR_GREATER_THAN = 5
 
const OPERATOR_GREATER_THAN_OR_EQUAL_TO = 6
 
const OPERATOR_LIKE = 7
 
const OPERATOR_CONTAINS = 8
 
const OPERATOR_IN = 9
 
const OPERATOR_IS_NULL = 10
 
const OPERATOR_IS_EMPTY = 11
 
const ORDER_ASCENDING = 'ASC'
 
const ORDER_DESCENDING = 'DESC'
 

Protected Member Functions

 getSelectorName ()
 

Protected Attributes

 $type
 
 $objectManager
 
 $dataMapper
 
 $persistenceManager
 
 $qomFactory
 
 $source
 
 $constraint
 
 $statement
 
 $orderings = array()
 
 $limit
 
 $offset
 
 $querySettings
 

Detailed Description

The Query class used to run queries against the database

Definition at line 23 of file Query.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Generic\Query::__construct (   $type)

Constructs a query object working on the given class name

Parameters
string$type

Definition at line 116 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$type.

Member Function Documentation

◆ __sleep()

TYPO3\CMS\Extbase\Persistence\Generic\Query::__sleep ( )
Returns
array

Definition at line 542 of file Query.php.

◆ __wakeup()

TYPO3\CMS\Extbase\Persistence\Generic\Query::__wakeup ( )
Returns
void

Definition at line 532 of file Query.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ contains()

TYPO3\CMS\Extbase\Persistence\Generic\Query::contains (   $propertyName,
  $operand 
)

Returns a "contains" criterion used for matching objects against a query. It matches if the multivalued property contains the given operand.

Parameters
string$propertyNameThe name of the (multivalued) property to compare against
mixed$operandThe value to compare with
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 460 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_CONTAINS.

◆ count()

TYPO3\CMS\Extbase\Persistence\Generic\Query::count ( )

Returns the query result count.

Returns
integer The query result count

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 552 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\execute().

◆ equals()

TYPO3\CMS\Extbase\Persistence\Generic\Query::equals (   $propertyName,
  $operand,
  $caseSensitive = TRUE 
)

Returns an equals criterion used for matching objects against a query

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with
boolean$caseSensitiveWhether the equality test should be done case-sensitive
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 421 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\CHARSET, TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_EQUAL_TO.

◆ execute()

TYPO3\CMS\Extbase\Persistence\Generic\Query::execute (   $returnRawQueryResult = FALSE)

Executes the query against the database and returns the result

Parameters
$returnRawQueryResultboolean avoids the object mapping by the persistence
Returns
|array The query result object or an array if $returnRawQueryResult is TRUE

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 199 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\getQuerySettings().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Query\count().

◆ getConstraint()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getConstraint ( )

Gets the constraint for this query.

Returns
|NULL the constraint, or null if none

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 345 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$constraint.

◆ getLimit()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getLimit ( )

Returns the maximum size of the result set to limit.

Returns
integer

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 273 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$limit.

◆ getOffset()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getOffset ( )

Returns the start offset of the result set.

Returns
integer

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 300 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$offset.

◆ getOrderings()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getOrderings ( )

Returns the property names to order the result by. Like this: array( 'foo' => ::ORDER_ASCENDING, 'bar' => ::ORDER_DESCENDING )

Returns
array

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 234 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$orderings.

◆ getQuerySettings()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getQuerySettings ( )

Returns the Query Settings.

Exceptions
Exception
Returns
QuerySettingsInterface $querySettings The Query Settings This method is not part of FLOW3 API

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 139 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$querySettings.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Query\execute().

◆ getSelectorName()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getSelectorName ( )
protected

Returns the selectorn name or an empty string, if the source is not a selector TODO This has to be checked at another place

Returns
string The selector name

Definition at line 171 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$source, and TYPO3\CMS\Extbase\Persistence\Generic\Query\getSource().

◆ getSource()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getSource ( )

Gets the node-tuple source for this query.

Returns
the node-tuple source; non-null

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 185 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$source, and TYPO3\CMS\Extbase\Persistence\Generic\Query\getType().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Query\getSelectorName().

◆ getStatement()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getStatement ( )

Returns the statement of this query.

Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 335 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$statement.

◆ getType()

TYPO3\CMS\Extbase\Persistence\Generic\Query::getType ( )

Returns the type this query cares for.

Returns
string

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 152 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$type.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Query\getSource().

◆ greaterThan()

TYPO3\CMS\Extbase\Persistence\Generic\Query::greaterThan (   $propertyName,
  $operand 
)

Returns a greater than criterion used for matching objects against a query

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 513 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_GREATER_THAN.

◆ greaterThanOrEqual()

TYPO3\CMS\Extbase\Persistence\Generic\Query::greaterThanOrEqual (   $propertyName,
  $operand 
)

Returns a greater than or equal criterion used for matching objects against a query

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 525 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_GREATER_THAN_OR_EQUAL_TO.

◆ in()

TYPO3\CMS\Extbase\Persistence\Generic\Query::in (   $propertyName,
  $operand 
)

Returns an "in" criterion used for matching objects against a query. It matches if the property's value is contained in the multivalued operand.

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with, multivalued
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 474 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_IN.

◆ isEmpty()

TYPO3\CMS\Extbase\Persistence\Generic\Query::isEmpty (   $propertyName)

Returns an "isEmpty" criterion used for matching objects against a query. It matches if the multivalued property contains no values or is NULL.

Parameters
string$propertyNameThe name of the multivalued property to compare against
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 566 of file Query.php.

◆ lessThan()

TYPO3\CMS\Extbase\Persistence\Generic\Query::lessThan (   $propertyName,
  $operand 
)

Returns a less than criterion used for matching objects against a query

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 489 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_LESS_THAN.

◆ lessThanOrEqual()

TYPO3\CMS\Extbase\Persistence\Generic\Query::lessThanOrEqual (   $propertyName,
  $operand 
)

Returns a less or equal than criterion used for matching objects against a query

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 501 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_LESS_THAN_OR_EQUAL_TO.

◆ like()

TYPO3\CMS\Extbase\Persistence\Generic\Query::like (   $propertyName,
  $operand,
  $caseSensitive = TRUE 
)

Returns a like criterion used for matching objects against a query

Parameters
string$propertyNameThe name of the property to compare against
mixed$operandThe value to compare with
boolean$caseSensitiveWhether the matching should be done case-sensitive
Returns

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 447 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\OPERATOR_LIKE.

◆ logicalAnd()

TYPO3\CMS\Extbase\Persistence\Generic\Query::logicalAnd (   $constraint1)

Performs a logical conjunction of the given constraints. The method takes one or more constraints and concatenates them with a boolean AND. It also accepts a single array of constraints to be concatenated.

Parameters
mixed$constraint1The first of multiple constraints or an array of constraints.
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 358 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$constraint.

◆ logicalNot()

TYPO3\CMS\Extbase\Persistence\Generic\Query::logicalNot ( \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface  $constraint)

Performs a logical negation of the given constraint

Parameters
\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface$constraintConstraint to negate
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 408 of file Query.php.

◆ logicalOr()

TYPO3\CMS\Extbase\Persistence\Generic\Query::logicalOr (   $constraint1)

Performs a logical disjunction of the two given constraints

Parameters
mixed$constraint1The first of multiple constraints or an array of constraints.
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 383 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$constraint.

◆ matching()

TYPO3\CMS\Extbase\Persistence\Generic\Query::matching (   $constraint)

The constraint used to limit the result set. Returns $this to allow for chaining (fluid interface)

Parameters
\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface$constraint
Returns
QueryInterface

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 312 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$constraint.

◆ setLimit()

TYPO3\CMS\Extbase\Persistence\Generic\Query::setLimit (   $limit)

Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface)

Parameters
integer$limit
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 247 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$limit.

◆ setOffset()

TYPO3\CMS\Extbase\Persistence\Generic\Query::setOffset (   $offset)

Sets the start offset of the result set to offset. Returns $this to allow for chaining (fluid interface)

Parameters
integer$offset
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 286 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$offset.

◆ setOrderings()

TYPO3\CMS\Extbase\Persistence\Generic\Query::setOrderings ( array  $orderings)

Sets the property names to order the result by. Expected like this: array( 'foo' => ::ORDER_ASCENDING, 'bar' => ::ORDER_DESCENDING ) where 'foo' and 'bar' are property names.

Parameters
array$orderingsThe property names to order by
Returns
QueryInterface

Implements TYPO3\CMS\Extbase\Persistence\QueryInterface.

Definition at line 219 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$orderings.

◆ setQuerySettings()

TYPO3\CMS\Extbase\Persistence\Generic\Query::setQuerySettings ( QuerySettingsInterface  $querySettings)

Sets the Query Settings. These Query settings must match the settings expected by the specific Storage Backend.

Parameters
QuerySettingsInterface$querySettingsThe Query Settings
Returns
void This method is not part of FLOW3 API

Definition at line 128 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$querySettings.

◆ setSource()

TYPO3\CMS\Extbase\Persistence\Generic\Query::setSource ( \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface  $source)

Sets the source to fetch the result from

Parameters
\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface$source

Definition at line 161 of file Query.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Query\$source.

◆ statement()

TYPO3\CMS\Extbase\Persistence\Generic\Query::statement (   $statement,
array  $parameters = array() 
)

Sets the statement of this query. If you use this, you will lose the abstraction from a concrete storage backend (database).

Parameters
string | \TYPO3\CMS\Core\Database\PreparedStatement$statementThe statement
array$parametersAn array of parameters. These will be bound to placeholders '?' in the $statement.
Returns
QueryInterface

Definition at line 325 of file Query.php.

References $parameters, and TYPO3\CMS\Extbase\Persistence\Generic\Query\$statement.

◆ unsetLimit()

TYPO3\CMS\Extbase\Persistence\Generic\Query::unsetLimit ( )

Resets a previously set maximum size of the result set. Returns $this to allow for chaining (fluid interface)

Returns
QueryInterface

Definition at line 262 of file Query.php.

Member Data Documentation

◆ $constraint

◆ $dataMapper

TYPO3\CMS\Extbase\Persistence\Generic\Query::$dataMapper
protected

Definition at line 60 of file Query.php.

◆ $limit

TYPO3\CMS\Extbase\Persistence\Generic\Query::$limit
protected

◆ $objectManager

TYPO3\CMS\Extbase\Persistence\Generic\Query::$objectManager
protected

Definition at line 54 of file Query.php.

◆ $offset

TYPO3\CMS\Extbase\Persistence\Generic\Query::$offset
protected

◆ $orderings

TYPO3\CMS\Extbase\Persistence\Generic\Query::$orderings = array()
protected

◆ $persistenceManager

TYPO3\CMS\Extbase\Persistence\Generic\Query::$persistenceManager
protected

Definition at line 66 of file Query.php.

◆ $qomFactory

TYPO3\CMS\Extbase\Persistence\Generic\Query::$qomFactory
protected

Definition at line 72 of file Query.php.

◆ $querySettings

TYPO3\CMS\Extbase\Persistence\Generic\Query::$querySettings
protected

◆ $source

◆ $statement

TYPO3\CMS\Extbase\Persistence\Generic\Query::$statement
protected

◆ $type

TYPO3\CMS\Extbase\Persistence\Generic\Query::$type
protected

◆ CHARSET

const TYPO3\CMS\Extbase\Persistence\Generic\Query::CHARSET = 'utf-8'

Charset of strings in QOM

Definition at line 43 of file Query.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Query\equals().

◆ JCR_JOIN_TYPE_INNER

const TYPO3\CMS\Extbase\Persistence\Generic\Query::JCR_JOIN_TYPE_INNER = '{http://www.jcp.org/jcr/1.0}joinTypeInner'

An inner join.

Definition at line 28 of file Query.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getSource().

◆ JCR_JOIN_TYPE_LEFT_OUTER

const TYPO3\CMS\Extbase\Persistence\Generic\Query::JCR_JOIN_TYPE_LEFT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeLeftOuter'

A left-outer join.

Definition at line 33 of file Query.php.

◆ JCR_JOIN_TYPE_RIGHT_OUTER

const TYPO3\CMS\Extbase\Persistence\Generic\Query::JCR_JOIN_TYPE_RIGHT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeRightOuter'

A right-outer join.

Definition at line 38 of file Query.php.