CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • Association
  • AssociationCollection
  • Behavior
  • BehaviorRegistry
  • EagerLoader
  • Entity
  • Marshaller
  • Query
  • ResultSet
  • RulesChecker
  • SaveOptionsBuilder
  • Table
  • TableRegistry

Interfaces

  • PropertyMarshalInterface

Traits

  • AssociationsNormalizerTrait

Class ResultSet

Represents the results obtained after executing a query for a specific table This object is responsible for correctly nesting result keys reported from the query, casting each field to the correct type and executing the extra queries required for eager loading external associations.

Cake\ORM\ResultSet implements Cake\Datasource\ResultSetInterface uses Cake\Collection\CollectionTrait
Namespace: Cake\ORM
Location: ORM/ResultSet.php

Properties summary

  • $_autoFields protected
    boolean
    Tracks value of $_autoFields property of $query passed to constructor.
  • $_containMap protected
    array
    List of associations that should be eager loaded.
  • $_count protected
    integer
    Holds the count of records in this result set
  • $_current protected
    array
    Last record fetched from the statement
  • $_defaultAlias protected
    string
    The default table alias
  • $_defaultTable protected
    Cake\ORM\Table|Cake\Datasource\RepositoryInterface
    Default table instance
  • $_driver protected
    Cake\Database\Driver
    The Database driver object.
  • $_entityClass protected
    string
    The fully namespaced name of the class to use for hydrating results
  • $_hydrate protected
    boolean
    Whether to hydrate results into objects or not
  • $_index protected
    integer
    Points to the next record number that should be fetched
  • $_map protected
    array

    Map of fields that are fetched from the statement with their type and the table they belong to

  • $_matchingMap protected
    array

    List of associations that should be placed under the _matchingData result key.

  • $_matchingMapColumns protected
    array

    List of matching associations and the column keys to expect from each of them.

  • $_query protected
    Cake\ORM\Query
    Original query from where results were generated
  • $_results protected
    array|ArrayAccess
    Results that have been fetched or hydrated into the results.
  • $_statement protected
    Cake\Database\StatementInterface
    Database statement holding the results
  • $_types protected
    array
    Type cache for type converters.
  • $_useBuffering protected
    boolean
    Whether or not to buffer results fetched from the statement

Method Summary

  • __construct() public
    Constructor
  • __debugInfo() public

    Returns an array that can be used to describe the internal state of this object.

  • _calculateAssociationMap() protected

    Calculates the list of associations that should get eager loaded when fetching each record

  • _calculateColumnMap() protected

    Creates a map of row keys out of the query select clause that can be used to hydrate nested result sets more quickly.

  • _calculateTypeMap() protected deprecated

    Creates a map of Type converter classes for each of the columns that should be fetched by this object.

  • _castValues() protected deprecated

    Casts all values from a row brought from a table to the correct PHP type.

  • _fetchResult() protected

    Helper function to fetch the next result from the statement or seeded results.

  • _getTypes() protected deprecated

    Returns the Type classes for each of the passed fields belonging to the table.

  • _groupResult() protected
    Correctly nests results keys including those coming from associations
  • count() public
    Gives the number of rows in the result set.
  • current() public
    Returns the current record in the result iterator
  • first() public
    Get the first record from a result set.
  • key() public
    Returns the key of the current record in the iterator
  • next() public
    Advances the iterator pointer to the next record
  • rewind() public
    Rewinds a ResultSet.
  • serialize() public
    Serializes a resultset.
  • unserialize() public
    Unserializes a resultset.
  • valid() public
    Whether there are more results to be fetched from the iterator

Method Detail

__construct() public ¶

__construct( Cake\ORM\Query $query , Cake\Database\StatementInterface $statement )

Constructor

Parameters
Cake\ORM\Query $query
Query from where results come
Cake\Database\StatementInterface $statement
The statement to fetch from

__debugInfo() public ¶

__debugInfo( )

Returns an array that can be used to describe the internal state of this object.

Returns
array

_calculateAssociationMap() protected ¶

_calculateAssociationMap( Cake\ORM\Query $query )

Calculates the list of associations that should get eager loaded when fetching each record

Parameters
Cake\ORM\Query $query
The query from where to derive the associations

_calculateColumnMap() protected ¶

_calculateColumnMap( Cake\ORM\Query $query )

Creates a map of row keys out of the query select clause that can be used to hydrate nested result sets more quickly.

Parameters
Cake\ORM\Query $query
The query from where to derive the column map

_calculateTypeMap() protected deprecated ¶

_calculateTypeMap( )

Creates a map of Type converter classes for each of the columns that should be fetched by this object.

Deprecated
3.2.0 Not used anymore. Type casting is done at the statement level

_castValues() protected deprecated ¶

_castValues( string $alias , array $values )

Casts all values from a row brought from a table to the correct PHP type.

Deprecated
3.2.0 Not used anymore. Type casting is done at the statement level
Parameters
string $alias
The table object alias
array $values
The values to cast
Returns
array

_fetchResult() protected ¶

_fetchResult( )

Helper function to fetch the next result from the statement or seeded results.

Returns
mixed

_getTypes() protected deprecated ¶

_getTypes( Cake\ORM\Table $table , array $fields )

Returns the Type classes for each of the passed fields belonging to the table.

Deprecated
3.2.0 Not used anymore. Type casting is done at the statement level
Parameters
Cake\ORM\Table $table
The table from which to get the schema
array $fields
The fields whitelist to use for fields in the schema.
Returns
array

_groupResult() protected ¶

_groupResult( array $row )

Correctly nests results keys including those coming from associations

Parameters
array $row
Array containing columns and values or false if there is no results
Returns
array
Results

count() public ¶

count( )

Gives the number of rows in the result set.

Part of the Countable interface.

Returns
integer
Implementation of
Cake\Collection\CollectionInterface::count()

current() public ¶

current( )

Returns the current record in the result iterator

Part of Iterator interface.

Returns
array|object
Implementation of
Iterator::current()

first() public ¶

first( )

Get the first record from a result set.

This method will also close the underlying statement cursor.

Returns
array|object
Implementation of
Cake\Collection\CollectionInterface::first()

key() public ¶

key( )

Returns the key of the current record in the iterator

Part of Iterator interface.

Returns
integer
Implementation of
Iterator::key()

next() public ¶

next( )

Advances the iterator pointer to the next record

Part of Iterator interface.

Implementation of
Iterator::next()

rewind() public ¶

rewind( )

Rewinds a ResultSet.

Part of Iterator interface.

Throws
Cake\Database\Exception
Implementation of
Iterator::rewind()

serialize() public ¶

serialize( )

Serializes a resultset.

Part of Serializable interface.

Returns
string
Serialized object
Implementation of
Serializable::serialize()

unserialize() public ¶

unserialize( string $serialized )

Unserializes a resultset.

Part of Serializable interface.

Parameters
string $serialized
Serialized object
Implementation of
Serializable::unserialize()

valid() public ¶

valid( )

Whether there are more results to be fetched from the iterator

Part of Iterator interface.

Returns
boolean
Implementation of
Iterator::valid()

Methods used from Cake\Collection\CollectionTrait

_unwrap() public ¶

_unwrap( )

append() public ¶

append( $items )

appendItem() public ¶

appendItem( $item , $key = null )

avg() public ¶

avg( $matcher = null )

buffered() public ¶

buffered( )

Returns
Cake\Collection\Iterator\BufferedIterator

cartesianProduct() public ¶

cartesianProduct( callable $operation = null , callable $filter = null )

Parameters
callable $operation optional null
Operation
callable $filter optional null
Filter
Returns
Cake\Collection\CollectionInterface
Throws
LogicException

chunk() public ¶

chunk( $chunkSize )

chunkWithKeys() public ¶

chunkWithKeys( $chunkSize , $preserveKeys = true )

combine() public ¶

combine( $keyPath , $valuePath , $groupPath = null )

compile() public ¶

compile( $preserveKeys = true )

contains() public ¶

contains( $value )

countBy() public ¶

countBy( $callback )

countKeys() public ¶

countKeys( )

Returns
integer

each() public ¶

each( callable $c )

every() public ¶

every( callable $c )

extract() public ¶

extract( $matcher )

filter() public ¶

filter( callable $c = null )

Returns
Cake\Collection\Iterator\FilterIterator

firstMatch() public ¶

firstMatch( array $conditions )

groupBy() public ¶

groupBy( $callback )

indexBy() public ¶

indexBy( $callback )

insert() public ¶

insert( $path , $values )

Returns
Cake\Collection\Iterator\InsertIterator

isEmpty() public ¶

isEmpty( )

jsonSerialize() public ¶

jsonSerialize( )

last() public ¶

last( )

lazy() public ¶

lazy( )

listNested() public ¶

listNested( $dir = 'desc' , $nestingKey = 'children' )

Returns
Cake\Collection\Iterator\TreeIterator

map() public ¶

map( callable $c )

Returns
Cake\Collection\Iterator\ReplaceIterator

match() public ¶

match( array $conditions )

max() public ¶

max( $callback , $type = \SORT_NUMERIC )

median() public ¶

median( $matcher = null )

min() public ¶

min( $callback , $type = \SORT_NUMERIC )

nest() public ¶

nest( $idPath , $parentPath , $nestingKey = 'children' )

newCollection() protected ¶

newCollection( ... $args )

Returns a new collection.

Allows classes which use this trait to determine their own type of returned collection interface

Parameters
... $args
$args Constructor arguments.
Returns
Cake\Collection\CollectionInterface

optimizeUnwrap() protected ¶

optimizeUnwrap( )

Unwraps this iterator and returns the simplest traversable that can be used for getting the data out

Returns
Traversable|array

prepend() public ¶

prepend( $items )

prependItem() public ¶

prependItem( $item , $key = null )

reduce() public ¶

reduce( callable $c , $zero = null )

reject() public ¶

reject( callable $c )

Returns
Cake\Collection\Iterator\FilterIterator

sample() public ¶

sample( $size = 10 )

shuffle() public ¶

shuffle( )

skip() public ¶

skip( $howMany )

some() public ¶

some( callable $c )

sortBy() public ¶

sortBy( $callback , $dir = \SORT_DESC , $type = \SORT_NUMERIC )

stopWhen() public ¶

stopWhen( $condition )

Returns
Cake\Collection\Iterator\StoppableIterator

sumOf() public ¶

sumOf( $matcher = null )

take() public ¶

take( $size = 1 , $from = 0 )

takeLast() public ¶

takeLast( $howMany )

through() public ¶

through( callable $handler )

toArray() public ¶

toArray( $preserveKeys = true )

toList() public ¶

toList( )

transpose() public ¶

transpose( )

Returns
Cake\Collection\CollectionInterface
Throws
LogicException

unfold() public ¶

unfold( callable $transformer = null )

unwrap() public ¶

unwrap( )

zip() public ¶

zip( $items )

zipWith() public ¶

zipWith( $items , $callable )

Magic methods inherited from Cake\Collection\CollectionInterface

cartesianProduct()

Properties detail

$_autoFields ¶

protected boolean

Tracks value of $_autoFields property of $query passed to constructor.

$_containMap ¶

protected array

List of associations that should be eager loaded.

[]

$_count ¶

protected integer

Holds the count of records in this result set

$_current ¶

protected array

Last record fetched from the statement

$_defaultAlias ¶

protected string

The default table alias

$_defaultTable ¶

protected Cake\ORM\Table|Cake\Datasource\RepositoryInterface

Default table instance

$_driver ¶

protected Cake\Database\Driver

The Database driver object.

Cached in a property to avoid multiple calls to the same function.

$_entityClass ¶

protected string

The fully namespaced name of the class to use for hydrating results

$_hydrate ¶

protected boolean

Whether to hydrate results into objects or not

true

$_index ¶

protected integer

Points to the next record number that should be fetched

$_map ¶

protected array

Map of fields that are fetched from the statement with their type and the table they belong to

[]

$_matchingMap ¶

protected array

List of associations that should be placed under the _matchingData result key.

[]

$_matchingMapColumns ¶

protected array

List of matching associations and the column keys to expect from each of them.

[]

$_query ¶

protected Cake\ORM\Query

Original query from where results were generated

Deprecated
3.1.6 Due to a memory leak, this property cannot be used anymore

$_results ¶

protected array|ArrayAccess

Results that have been fetched or hydrated into the results.

[]

$_statement ¶

protected Cake\Database\StatementInterface

Database statement holding the results

$_types ¶

protected array

Type cache for type converters.

Converters are indexed by alias and column name.

Deprecated
3.2.0 Not used anymore. Type casting is done at the statement level
[]

$_useBuffering ¶

protected boolean

Whether or not to buffer results fetched from the statement

true
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs