Skip to content

Commit 0fcec06

Browse files
committed
Create a new Object everytime we cycle over the messages in the getList method. Fixes a bug where all messages are the same object when getting a list.
1 parent 507a604 commit 0fcec06

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/MessageBird/Resources/Base.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ public function getList($parameters = array ())
9898
$BaseList = new Objects\BaseList();
9999
$BaseList->loadFromArray($body);
100100

101+
$objectName = $this->Object;
102+
101103
foreach ($Items AS $Item) {
102-
$Message = $this->Object->loadFromArray($Item);
104+
$Object = new $objectName($this->HttpClient);
105+
106+
$Message = $Object->loadFromArray($Item);
103107
$BaseList->items[] = $Message;
104108
}
105109
return $BaseList;

0 commit comments

Comments
 (0)