‪TYPO3CMS  11.5
TYPO3\CMS\Extbase\Persistence\Generic\QueryResult Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Generic\QueryResult:
TYPO3\CMS\Extbase\Persistence\QueryResultInterface TYPO3\CMS\Extbase\Persistence\ForwardCompatibleQueryResultInterface TYPO3\CMS\Extbase\Persistence\QueryResultInterface

Public Member Functions

 __construct (DataMapper $dataMapper, PersistenceManagerInterface $persistenceManager)
 
 setQuery (QueryInterface $query)
 
QueryInterface getQuery ()
 
object getFirst ()
 
int count ()
 
array toArray ()
 
bool offsetExists ($offset)
 
mixed offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
mixed current ()
 
mixed key ()
 
 next ()
 
 rewind ()
 
bool valid ()
 
 __wakeup ()
 
array __sleep ()
 

Protected Member Functions

 initialize ()
 

Protected Attributes

DataMapper $dataMapper
 
PersistenceManagerInterface $persistenceManager
 
int null $numberOfResults
 
QueryInterface $query = null
 
array null $queryResult
 

Detailed Description

A lazy result list that is returned by Query::execute()

Todo:

v12: Drop ForwardCompatibleQueryResultInterface when merged into QueryResultInterface

v12: Candidate to declare final - Can be decorated or standalone class implementing the interface

Definition at line 31 of file QueryResult.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::__construct ( DataMapper  $dataMapper,
PersistenceManagerInterface  $persistenceManager 
)

Member Function Documentation

◆ __sleep()

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

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 269 of file QueryResult.php.

◆ __wakeup()

TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::__wakeup ( )

Ensures that the persistenceManager and dataMapper are back when loading the QueryResult from the cache

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 259 of file QueryResult.php.

◆ count()

int TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::count ( )

Returns the number of objects in the result

Returns
‪int The number of matching objects
Todo:
‪Set to return type int as breaking patch in v12.

Definition at line 109 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\$numberOfResults.

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic\QueryResultTest\countCallsGetObjectCountByQueryOnPersistenceManager(), and TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic\QueryResultTest\countDoesNotInitializeProxy().

◆ current()

mixed TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::current ( )
Returns
‪mixed
See also
‪Iterator::current()
Todo:
‪Set return type to mixed as breaking patch in v12.

Definition at line 202 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\getFirst(), and TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\valid().

◆ getFirst()

◆ getQuery()

QueryInterface TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::getQuery ( )

◆ initialize()

◆ key()

mixed TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::key ( )
Returns
‪mixed
See also
‪Iterator::key()
Todo:
‪Set return type to mixed as breaking patch in v12.

Definition at line 214 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ next()

TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::next ( )
See also
‪Iterator::next()
Todo:
‪Set return type to void as breaking patch in v12.

Definition at line 225 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ offsetExists()

bool TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::offsetExists (   $offset)

This method is needed to implement the ArrayAccess interface, but it isn't very useful as the offset has to be an integer

Parameters
mixed$offset
Returns
‪bool
See also
‪ArrayAccess::offsetExists()
Todo:

Set $offset to mixed type as breaking change in v12.

Set to return type bool as breaking change in v12.

Definition at line 143 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ offsetGet()

mixed TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::offsetGet (   $offset)
Parameters
mixed$offset
Returns
‪mixed
See also
‪ArrayAccess::offsetGet()
Todo:

Set $offset to mixed type as breaking change in v12.

Set return type to ?mixed as breaking patch in v12.

Definition at line 157 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ offsetSet()

TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::offsetSet (   $offset,
  $value 
)

This method has no effect on the persisted objects but only on the result set

Parameters
mixed$offset
mixed$value
See also
‪ArrayAccess::offsetSet()
Todo:

Set $offset and $value to mixed type as breaking change in v12.

Set return type to void as breaking patch in v12.

Definition at line 173 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ offsetUnset()

TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::offsetUnset (   $offset)

This method has no effect on the persisted objects but only on the result set

Parameters
mixed$offset
See also
‪ArrayAccess::offsetUnset()
Todo:

Set $offset to mixed type as breaking change in v12.

Set return type to void as breaking patch in v12.

Definition at line 189 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ rewind()

TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::rewind ( )
See also
‪Iterator::rewind()
Todo:
‪Set return type to void as breaking patch in v12.

Definition at line 236 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ setQuery()

◆ toArray()

array TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::toArray ( )

Returns an array with the objects in the result set

Returns
‪array

Implements TYPO3\CMS\Extbase\Persistence\QueryResultInterface.

Definition at line 126 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

◆ valid()

bool TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::valid ( )
Returns
‪bool
See also
‪Iterator::valid()
Todo:
‪Set return type to bool as breaking patch in v12.

Definition at line 248 of file QueryResult.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\current(), and TYPO3\CMS\Extbase\Persistence\Generic\QueryResult\initialize().

Member Data Documentation

◆ $dataMapper

DataMapper TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::$dataMapper
protected

◆ $numberOfResults

int null TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::$numberOfResults
protected

◆ $persistenceManager

PersistenceManagerInterface TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::$persistenceManager
protected

◆ $query

◆ $queryResult

array null TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::$queryResult
protected