Skip to content

Commit 4a044c0

Browse files
Merge branch 'apigee:4.x' into issue-newer-php-4.x
2 parents 14d6ab1 + b6413ae commit 4a044c0

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/Api/ApigeeX/Controller/AppGroupMembersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function getAppGroupAttributes(): AttributesProperty
114114
$appGroup = $this->responseToArray($this->client->get($this->getBaseEndpointUri()));
115115
$serializer = new AttributesPropertyAwareEntitySerializer();
116116
$appGroupAttributes = $serializer->denormalize(
117-
$appGroup['attributes'],
117+
$appGroup['attributes'] ?? '',
118118
AttributesProperty::class
119119
);
120120

src/Denormalizer/AttributesPropertyDenormalizer.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ public function supportsDenormalization($data, $type, $format = null, array $con
5151
public function denormalize($data, $type, $format = null, array $context = []): mixed
5252
{
5353
$flatten = [];
54-
foreach ($data as $key => $item) {
55-
if (is_object($item)) {
56-
// $data came from the EntityNormalizer.
57-
$flatten[$item->name] = $item->value ?? null;
58-
} else {
59-
$flatten[$key] = $item;
54+
// The Apigee X API omits the 'attributes' key entirely on new/empty
55+
// AppGroups (teams), so $data can be null here.
56+
if (!empty($data)) {
57+
foreach ($data as $key => $item) {
58+
if (is_object($item)) {
59+
// $data came from the EntityNormalizer.
60+
$flatten[$item->name] = $item->value ?? null;
61+
} else {
62+
$flatten[$key] = $item;
63+
}
6064
}
6165
}
6266
$data = $flatten;

0 commit comments

Comments
 (0)