Skip to content

Commit ab2f83e

Browse files
committed
fix collection walk when using specific callback instead of default model
1 parent 989af63 commit ab2f83e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/internal/Magento/Framework/Data/Collection.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,16 +500,19 @@ public function clear()
500500
*/
501501
public function walk($callback, array $args = [])
502502
{
503-
$results = [];
503+
$results = [];
504504
$useItemCallback = is_string($callback) && strpos($callback, '::') === false;
505505
foreach ($this->getItems() as $id => $item) {
506+
$params = $args;
506507
if ($useItemCallback) {
507508
$cb = [$item, $callback];
508509
} else {
509510
$cb = $callback;
510-
array_unshift($args, $item);
511+
array_unshift($params, $item);
511512
}
512-
$results[$id] = call_user_func_array($cb, $args);
513+
//@codingStandardsIgnoreStart
514+
$results[$id] = call_user_func_array($cb, $params);
515+
//@codingStandardsIgnoreEnd
513516
}
514517
return $results;
515518
}

0 commit comments

Comments
 (0)