$_extractor
$_extractor : callable
A callable responsible for extracting a single value for each item in the collection.
Creates an iterator from another iterator that extract the requested column or property based on a path
__construct(array|\Traversable $items, string $path)
Creates the iterator that will return the requested property for each value in the collection expressed in $path
Extract the user name for all comments in the array:
$items = [
['comment' => ['body' => 'cool', 'user' => ['name' => 'Mark']],
['comment' => ['body' => 'very cool', 'user' => ['name' => 'Renan']]
];
$extractor = new ExtractIterator($items, 'comment.user.name'');
array|\Traversable | $items | The list of values to iterate |
string | $path | a dot separated string symbolizing the path to follow inside the hierarchy of each value so that the column can be extracted. |
filter(callable $c = null) : \Cake\Collection\Iterator\FilterIterator
{@inheritDoc}
callable | $c |
reject(callable $c) : \Cake\Collection\Iterator\FilterIterator
{@inheritDoc}
callable | $c |
map(callable $c) : \Cake\Collection\Iterator\ReplaceIterator
{@inheritDoc}
callable | $c |
insert( $path, $values) : \Cake\Collection\Iterator\InsertIterator
{@inheritDoc}
$path | ||
$values |
buffered() : \Cake\Collection\Iterator\BufferedIterator
{@inheritDoc}
listNested( $dir = 'desc', $nestingKey = 'children') : \Cake\Collection\Iterator\TreeIterator
{@inheritDoc}
$dir | ||
$nestingKey |
stopWhen( $condition) : \Cake\Collection\Iterator\StoppableIterator
{@inheritDoc}
$condition |
cartesianProduct(callable|null $operation = null, callable|null $filter = null) : \Cake\Collection\CollectionInterface
callable|null | $operation | Operation |
callable|null | $filter | Filter |
transpose() : \Cake\Collection\CollectionInterface
{@inheritDoc}