Skip to content

Commit cd5c376

Browse files
committed
Return correct array keys
1 parent 89e1046 commit cd5c376

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ConstantContact/Definition/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(array $initialValues = [])
2626
{
2727
foreach (static::$fields as $field => $type)
2828
{
29-
if (isset($initialValues[$field]))
29+
if (! empty($initialValues[$field]))
3030
{
3131
$this->setFields[$field] = true;
3232
$this->data[$field] = $initialValues[$field];
@@ -176,7 +176,7 @@ public function getData() : array
176176
}
177177
$result[$field] = [];
178178

179-
foreach ($value as $item)
179+
foreach ($value as $name => $item)
180180
{
181181
if ($item instanceof self)
182182
{
@@ -186,7 +186,7 @@ public function getData() : array
186186
{
187187
$item = (string)$item;
188188
}
189-
$result[$field][] = $item;
189+
$result[$field][$name] = $item;
190190
}
191191
}
192192
else

0 commit comments

Comments
 (0)