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.3 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.3
      • 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
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
      • Session
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Constraint
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • Collection

Interfaces

  • CollectionInterface

Traits

  • CollectionTrait
  • ExtractTrait

Trait CollectionTrait

Offers a handful of method 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 deprecated
    Backwards compatible wrapper for unwrap()
  • append() public
  • buffered() public
  • cartesianProduct() public
  • chunk() public
  • combine() public
  • compile() public
  • contains() public
  • countBy() 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
  • listNested() public
  • map() public
  • match() public
  • max() public
  • min() public
  • nest() public
  • reduce() public
  • reject() public
  • sample() public
  • shuffle() public
  • skip() public
  • some() public
  • sortBy() public
  • stopWhen() public
  • sumOf() public
  • take() public
  • through() public
  • toArray() public
  • toList() public
  • transpose() public
  • unfold() public
  • unwrap() public
  • zip() public
  • zipWith() public

Method Detail

_unwrap() public deprecated ¶

_unwrap( )

Backwards compatible wrapper for unwrap()

Deprecated
Returns
Iterator

append() public ¶

append( $items )

buffered() public ¶

buffered( )

Returns
Cake\Collection\Iterator\BufferedIterator

cartesianProduct() public ¶

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

Returns
Cake\Collection\CollectionInterface

chunk() public ¶

chunk( $chunkSize )

combine() public ¶

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

compile() public ¶

compile( $preserveKeys = true )

contains() public ¶

contains( $value )

countBy() public ¶

countBy( $callback )

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

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 )

min() public ¶

min( $callback , $type = SORT_NUMERIC )

nest() public ¶

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

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 )

through() public ¶

through( callable $handler )

toArray() public ¶

toArray( $preserveKeys = true )

toList() public ¶

toList( )

transpose() public ¶

transpose( )

Returns
Cake\Collection\CollectionInterface

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
callable

_extract() protected ¶

_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 {*}

Parameters
array|ArrayAccess $data
Data.
array $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 , array $path )

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

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