\Cake\Collection\IteratorInsertIterator

This iterator will insert values into a property of each of the records returned.

The values to be inserted come out of another traversal object. This is useful when you have two separate collections and want to merge them together by placing each of the values from one collection into a property inside the other collection.

Summary

Methods
Properties
Constants
__construct()
serialize()
unserialize()
count()
countKeys()
__debugInfo()
each()
filter()
reject()
every()
some()
contains()
map()
reduce()
extract()
max()
min()
avg()
median()
sortBy()
groupBy()
indexBy()
countBy()
sumOf()
shuffle()
sample()
take()
skip()
match()
firstMatch()
first()
last()
takeLast()
append()
appendItem()
prepend()
prependItem()
combine()
nest()
insert()
toArray()
toList()
jsonSerialize()
compile()
lazy()
buffered()
listNested()
stopWhen()
unfold()
through()
zip()
zipWith()
chunk()
chunkWithKeys()
isEmpty()
unwrap()
_unwrap()
cartesianProduct()
transpose()
next()
current()
rewind()
No public properties found
No constants found
optimizeUnwrap()
$_values
$_validValues
$_path
$_target
N/A
No private methods found
No private properties found
N/A

Properties

$_values

$_values : \Cake\Collection\Collection

The collection from which to extract the values to be inserted

Type

\Cake\Collection\Collection

$_validValues

$_validValues : boolean

Holds whether the values collection is still valid. (has more records)

Type

boolean

$_path

$_path : array

An array containing each of the properties to be traversed to reach the point where the values should be inserted.

Type

array

$_target

$_target : string

The property name to which values will be assigned

Type

string

Methods

__construct()

__construct(array|\Traversable  $into, string  $path, array|\Traversable  $values) 

Constructs a new collection that will dynamically add properties to it out of the values found in $values.

Parameters

array|\Traversable $into

The target collection to which the values will be inserted at the specified path.

string $path

A dot separated list of properties that need to be traversed to insert the value into the target collection.

array|\Traversable $values

The source collection from which the values will be inserted at the specified path.

serialize()

serialize() : string

Returns a string representation of this object that can be used to reconstruct it

Returns

string

unserialize()

unserialize(string  $collection) : void

Unserializes the passed string and rebuilds the Collection instance

Parameters

string $collection

The serialized collection

count()

count() : integer

{@inheritDoc}

Returns

integer

countKeys()

countKeys() : integer

{@inheritDoc}

Returns

integer

__debugInfo()

__debugInfo() : array

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

Returns

array

each()

each(callable  $c) 

{@inheritDoc}

Parameters

callable $c

every()

every(callable  $c) 

{@inheritDoc}

Parameters

callable $c

some()

some(callable  $c) 

{@inheritDoc}

Parameters

callable $c

contains()

contains(  $value) 

{@inheritDoc}

Parameters

$value

reduce()

reduce(callable  $c,   $zero = null) 

{@inheritDoc}

Parameters

callable $c
$zero

extract()

extract(  $matcher) 

{@inheritDoc}

Parameters

$matcher

max()

max(  $callback,   $type = \SORT_NUMERIC) 

{@inheritDoc}

Parameters

$callback
$type

min()

min(  $callback,   $type = \SORT_NUMERIC) 

{@inheritDoc}

Parameters

$callback
$type

avg()

avg(  $matcher = null) 

{@inheritDoc}

Parameters

$matcher

median()

median(  $matcher = null) 

{@inheritDoc}

Parameters

$matcher

sortBy()

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

{@inheritDoc}

Parameters

$callback
$dir
$type

groupBy()

groupBy(  $callback) 

{@inheritDoc}

Parameters

$callback

indexBy()

indexBy(  $callback) 

{@inheritDoc}

Parameters

$callback

countBy()

countBy(  $callback) 

{@inheritDoc}

Parameters

$callback

sumOf()

sumOf(  $matcher = null) 

{@inheritDoc}

Parameters

$matcher

shuffle()

shuffle() 

{@inheritDoc}

sample()

sample(  $size = 10) 

{@inheritDoc}

Parameters

$size

take()

take(  $size = 1,   $from) 

{@inheritDoc}

Parameters

$size
$from

skip()

skip(  $howMany) 

{@inheritDoc}

Parameters

$howMany

match()

match(array  $conditions) 

{@inheritDoc}

Parameters

array $conditions

firstMatch()

firstMatch(array  $conditions) 

{@inheritDoc}

Parameters

array $conditions

first()

first() 

{@inheritDoc}

last()

last() 

{@inheritDoc}

takeLast()

takeLast(  $howMany) 

{@inheritDoc}

Parameters

$howMany

append()

append(  $items) 

{@inheritDoc}

Parameters

$items

appendItem()

appendItem(  $item,   $key = null) 

{@inheritDoc}

Parameters

$item
$key

prepend()

prepend(  $items) 

{@inheritDoc}

Parameters

$items

prependItem()

prependItem(  $item,   $key = null) 

{@inheritDoc}

Parameters

$item
$key

combine()

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

{@inheritDoc}

Parameters

$keyPath
$valuePath
$groupPath

nest()

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

{@inheritDoc}

Parameters

$idPath
$parentPath
$nestingKey

toArray()

toArray(  $preserveKeys = true) 

{@inheritDoc}

Parameters

$preserveKeys

toList()

toList() 

{@inheritDoc}

jsonSerialize()

jsonSerialize() 

{@inheritDoc}

compile()

compile(  $preserveKeys = true) 

{@inheritDoc}

Parameters

$preserveKeys

lazy()

lazy() 

{@inheritDoc}

listNested()

listNested(  $dir = 'desc',   $nestingKey = 'children') : \Cake\Collection\Iterator\TreeIterator

{@inheritDoc}

Parameters

$dir
$nestingKey

Returns

\Cake\Collection\Iterator\TreeIterator

unfold()

unfold(callable  $transformer = null) 

{@inheritDoc}

Parameters

callable $transformer

through()

through(callable  $handler) 

{@inheritDoc}

Parameters

callable $handler

zip()

zip(  $items) 

{@inheritDoc}

Parameters

$items

zipWith()

zipWith(  $items,   $callable) 

{@inheritDoc}

Parameters

$items
$callable

chunk()

chunk(  $chunkSize) 

{@inheritDoc}

Parameters

$chunkSize

chunkWithKeys()

chunkWithKeys(  $chunkSize,   $preserveKeys = true) 

{@inheritDoc}

Parameters

$chunkSize
$preserveKeys

isEmpty()

isEmpty() 

{@inheritDoc}

unwrap()

unwrap() 

{@inheritDoc}

_unwrap()

_unwrap() 

cartesianProduct()

cartesianProduct(callable|null  $operation = null, callable|null  $filter = null) : \Cake\Collection\CollectionInterface

Parameters

callable|null $operation

Operation

callable|null $filter

Filter

Throws

\LogicException

Returns

\Cake\Collection\CollectionInterface

next()

next() : void

Advances the cursor to the next record

current()

current() : mixed

Returns the current element in the target collection after inserting the value from the source collection into the specified path.

Returns

mixed

rewind()

rewind() : void

Resets the collection pointer.

optimizeUnwrap()

optimizeUnwrap() : \Traversable|array

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

Returns

\Traversable|array