From fcaae95810dac8f9789fcadb1c10a427aa8bdf30 Mon Sep 17 00:00:00 2001 From: Meritoo Date: Tue, 27 Apr 2021 22:13:11 +0200 Subject: [PATCH] [BaseCollection] Prepare elements while adding them by addMultiple() method in the same way as passing them in constructor --- CHANGELOG.md | 5 +++++ VERSION | 2 +- src/Collection/BaseCollection.php | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9ddf64..82e49bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ Common and useful classes, methods, exceptions etc. +# 1.1.5 + +1. [BaseCollection] Prepare elements while adding them by `addMultiple()` method in the same way as passing them in + constructor. + # 1.1.4 1. [BaseCollection] Fix incorrectly working limit() method diff --git a/VERSION b/VERSION index 65087b4..e25d8d9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.4 +1.1.5 diff --git a/src/Collection/BaseCollection.php b/src/Collection/BaseCollection.php index 0b1f3dd..f2539dc 100644 --- a/src/Collection/BaseCollection.php +++ b/src/Collection/BaseCollection.php @@ -84,7 +84,9 @@ abstract class BaseCollection implements CollectionInterface return; } - foreach ($elements as $index => $element) { + $prepared = $this->prepareElements($elements); + + foreach ($prepared as $index => $element) { if ($useIndexes) { $this->add($element, $index);