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

  • Collection

Interfaces

  • CollectionInterface

Traits

  • CollectionTrait
  • ExtractTrait

Trait CollectionTrait

Offers a handful of methods to manipulate iterators

Cake\Collection\CollectionTrait uses Cake\Collection\ExtractTrait

Direct Users

  • Cake\Collection\Collection
  • Cake\Collection\Iterator\TreeIterator
  • Cake\Collection\Iterator\TreePrinter
  • Cake\Collection\Iterator\ZipIterator
  • Cake\ORM\ResultSet

Indirect Users

  • Cake\Collection\Iterator\BufferedIterator
  • Cake\Collection\Iterator\ExtractIterator
  • Cake\Collection\Iterator\FilterIterator
  • Cake\Collection\Iterator\InsertIterator
  • Cake\Collection\Iterator\NestIterator
  • Cake\Collection\Iterator\NoChildrenIterator
  • Cake\Collection\Iterator\ReplaceIterator
  • Cake\Collection\Iterator\SortIterator
  • Cake\Datasource\ResultSetDecorator
Namespace: Cake\Collection
Location: Collection/CollectionTrait.php

Method Summary

  • _unwrap() public
  • append() public
  • appendItem() public
  • avg() public
  • buffered() public
  • cartesianProduct() public
  • chunk() public
  • chunkWithKeys() public
  • combine() public
  • compile() public
  • contains() public
  • count() public
  • countBy() public
  • countKeys() public
  • each() public
  • every() public
  • extract() public
  • filter() public
  • first() public
  • firstMatch() public
  • groupBy() public
  • indexBy() public
  • insert() public
  • isEmpty() public
  • jsonSerialize() public
  • last() public
  • lazy() public
  • listNested() public
  • map() public
  • match() public
  • max() public
  • median() public
  • min() public
  • nest() public
  • newCollection() protected
    Returns a new collection.
  • optimizeUnwrap() protected

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

  • prepend() public
  • prependItem() public
  • reduce() public
  • reject() public
  • sample() public
  • shuffle() public
  • skip() public
  • some() public
  • sortBy() public
  • stopWhen() public
  • sumOf() public
  • take() public
  • takeLast() public
  • through() public
  • toArray() public
  • toList() public
  • transpose() public
  • unfold() public
  • unwrap() public
  • zip() public
  • zipWith() public

Method Detail

_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 )

count() public ¶

count( )

Returns
integer

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

first() public ¶

first( )

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 )

Methods used from Cake\Collection\ExtractTrait

_createMatcherFilter() protected ¶

_createMatcherFilter( array $conditions )

Returns a callable that receives a value and will return whether or not it matches certain condition.

Parameters
array $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.

Returns
Closure

_extract() protected ¶

_extract( array|ArrayAccess $data , string[] $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 {*}

Parameters
array|ArrayAccess $data
Data.
string[] $path
Path to extract from.
Returns
mixed

_propertyExtractor() protected ¶

_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.

Parameters
string|callable $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.

Returns
callable

_simpleExtract() protected ¶

_simpleExtract( array|ArrayAccess $data , string[] $path )

Returns a column from $data that can be extracted by iterating over the column names contained in $path

Parameters
array|ArrayAccess $data
Data.
string[] $path
Path to extract from.
Returns
mixed
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