Offers a handful of methods to manipulate iterators
Unwraps this iterator and returns the simplest traversable that can be used for getting the data out
_unwrap( )
append( $items )
appendItem( $item , $key = null )
avg( $matcher = null )
cartesianProduct( callable $operation = null , callable $filter = null )
$operation
optional null $filter
optional null Cake\Collection\CollectionInterface
chunk( $chunkSize )
chunkWithKeys( $chunkSize , $preserveKeys = true )
combine( $keyPath , $valuePath , $groupPath = null )
compile( $preserveKeys = true )
contains( $value )
countBy( $callback )
each( callable $c )
every( callable $c )
extract( $matcher )
first( )
firstMatch( array $conditions )
groupBy( $callback )
indexBy( $callback )
isEmpty( )
jsonSerialize( )
last( )
lazy( )
listNested( $dir = 'desc' , $nestingKey = 'children' )
Cake\Collection\Iterator\TreeIterator
match( array $conditions )
max( $callback , $type = \SORT_NUMERIC )
median( $matcher = null )
min( $callback , $type = \SORT_NUMERIC )
nest( $idPath , $parentPath , $nestingKey = 'children' )
newCollection( ... $args )
Returns a new collection.
Allows classes which use this trait to determine their own type of returned collection interface
$args
Cake\Collection\CollectionInterface
optimizeUnwrap( )
Unwraps this iterator and returns the simplest traversable that can be used for getting the data out
prepend( $items )
prependItem( $item , $key = null )
reduce( callable $c , $zero = null )
sample( $size = 10 )
shuffle( )
skip( $howMany )
some( callable $c )
sortBy( $callback , $dir = \SORT_DESC , $type = \SORT_NUMERIC )
sumOf( $matcher = null )
take( $size = 1 , $from = 0 )
takeLast( $howMany )
through( callable $handler )
toArray( $preserveKeys = true )
toList( )
transpose( )
Cake\Collection\CollectionInterface
unfold( callable $transformer = null )
unwrap( )
zip( $items )
zipWith( $items , $callable )
_createMatcherFilter( array $conditions )
Returns a callable that receives a value and will return whether or not it matches certain condition.
$conditions
A key-value list of conditions to match where the key is the property path to get from the current item and the value is the value to be compared the item with.
_extract( array|ArrayAccess $data , array $path )
Returns a column from $data that can be extracted by iterating over the column names contained in $path. It will return arrays for elements in represented with {*}
$data
$path
_propertyExtractor( string|callable $callback )
Returns a callable that can be used to extract a property or column from an array or object based on a dot separated path.
$callback
A dot separated path of column to follow so that the final one can be returned or a callable that will take care of doing that.
_simpleExtract( array|ArrayAccess $data , array $path )
Returns a column from $data that can be extracted by iterating over the column names contained in $path
$data
$path
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.Collection.CollectionTrait.html