QueryResult

class \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult

Implements
QueryResultInterface

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

Tags

todo

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

template
implements

Attributes

#[Autoconfigure]
$public: true
$shared: false

Table of Contents

Interfaces

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

Properties

$dataMapper  : DataMapper
$numberOfResults  : int|null
$persistenceManager  : PersistenceManagerInterface
$query  : QueryInterface<string|int, TValue>|null
$queryResult  : array<int, TValue>|null

Methods

__construct()  : mixed
__serialize()  : array{query: QueryInterface|null}
__unserialize()  : void
Ensures that the persistenceManager and dataMapper are back when loading the QueryResult from the cache
count()  : int
Returns the number of objects in the result
current()  : TValue|false
getFirst()  : TValue|null
Returns the first object in the result set
getQuery()  : QueryInterface<string|int, TValue>
Returns a clone of the query object
key()  : int|null
next()  : void
offsetExists()  : bool
This method is needed to implement the ArrayAccess interface, but it isn't very useful as the offset has to be an integer
offsetGet()  : TValue|null
offsetSet()  : void
This method has no effect on the persisted objects but only on the result set
offsetUnset()  : void
This method has no effect on the persisted objects but only on the result set
rewind()  : void
setQuery()  : void
toArray()  : array<int, TValue>
Returns an array with the objects in the result set
valid()  : bool
initialize()  : void
Loads the objects this QueryResult is supposed to hold

Properties

$numberOfResults

protected int|null $numberOfResults = null

$queryResult

protected array<int, TValue>|null $queryResult = null

Methods

__serialize()

public __serialize() : array{query: QueryInterface|null}

Return values

array{query: QueryInterface|null}

__unserialize()

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

public __unserialize(array $data) : void

Parameters

$data : array

count()

Returns the number of objects in the result

public count() : int

Return values

int

current()

public current() : TValue|false

Tags

see
Iterator::current()

Return values

TValue|false

getFirst()

Returns the first object in the result set

public getFirst() : TValue|null

Return values

TValue|null

key()

public key() : int|null

Tags

see
Iterator::key()

Return values

int|null

next()

public next() : void

Tags

see
Iterator::next()

offsetExists()

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

public offsetExists(string|int $offset) : bool

Parameters

$offset : string|int

Return values

bool

offsetGet()

public offsetGet(string|int $offset) : TValue|null

Parameters

$offset : string|int

Return values

TValue|null

offsetSet()

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

public offsetSet(string|int $offset, TValue $value) : void

Parameters

$offset : string|int
$value : TValue

offsetUnset()

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

public offsetUnset(string|int $offset) : void

Parameters

$offset : string|int

rewind()

public rewind() : void

Tags

see
Iterator::rewind()

toArray()

Returns an array with the objects in the result set

public toArray() : array<int, TValue>

Return values

array<int, TValue>

valid()

public valid() : bool

Tags

see
Iterator::valid()

Return values

bool

initialize()

Loads the objects this QueryResult is supposed to hold

protected initialize() : void
On this page