Skip to content

Commit 7593027

Browse files
resolved warning issues while create a new team
1 parent d0e0abf commit 7593027

2 files changed

Lines changed: 12 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: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,17 @@ 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+
}
62+
else {
63+
$flatten[$key] = $item;
64+
}
6065
}
6166
}
6267
$data = $flatten;

0 commit comments

Comments
 (0)