Class ResultSetFactory
Factory class for generating ResulSet instances.
It is responsible for correctly nesting result keys reported from the query and hydrating entities.
Property Summary
-
$resultSetClass protected
class-stringCake\Datasource\ResultSetInterface>
Method Summary
-
collectData() protected
Get repository and it's associations data for nesting results key and entity hydration.
-
createResultSet() public
Create a resultset instance.
-
getResultSetClass() public
Get the ResultSet class to use.
-
groupResult() protected
Correctly nests results keys including those coming from associations.
-
setResultSetClass() public
Set the ResultSet class to use.
Method Detail
collectData() ¶ protected
collectData(Cake\ORM\Query\SelectQuery $query): array
Get repository and it's associations data for nesting results key and entity hydration.
Parameters
-
Cake\ORM\Query\SelectQuery
$query The query from where to derive the data.
Returns
array
createResultSet() ¶ public
createResultSet(iterable $results, Cake\ORM\Query\SelectQuery<T>|null $query = null): Cake\Datasource\ResultSetInterface
Create a resultset instance.
Parameters
-
iterable
$results Results.
-
Cake\ORM\Query\SelectQuery<T>|null
$query optional Query from where results came.
Returns
Cake\Datasource\ResultSetInterface
getResultSetClass() ¶ public
getResultSetClass(): class-stringCake\Datasource\ResultSetInterface>
Get the ResultSet class to use.
Returns
class-stringCake\Datasource\ResultSetInterface>
groupResult() ¶ protected
groupResult(array $row, array $data): Cake\Datasource\EntityInterface|array
Correctly nests results keys including those coming from associations.
Hydrate row array into entity if hydration is enabled.
Parameters
-
array
$row Array containing columns and values.
-
array
$data Array containing table and query metadata
Returns
Cake\Datasource\EntityInterface|array
setResultSetClass() ¶ public
setResultSetClass(class-stringCake\Datasource\ResultSetInterface> $resultSetClass): $this
Set the ResultSet class to use.
Parameters
-
class-stringCake\Datasource\ResultSetInterface>
$resultSetClass Class name.
Returns
$this