Skip to content

Commit 82b3fba

Browse files
authored
[Improvement] Added system field "key" as optional argument for data object mutation (#987)
* Added system field "key" as optional argument for data object mutation * Updated Upgrade Notes
1 parent db784ff commit 82b3fba

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

doc/01_Installation_and_Upgrade/01_Upgrade_Notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Upgrade Notes
22

3+
## 2.2.0
4+
- [MutationType] Added system field `key` as an optional argument for data object mutation
5+
36
## 2.0.0
47

58
- [General] Marked several classes as internal and/or final.

src/GraphQL/Mutation/MutationType.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ public function buildDataObjectMutations(&$config = [], $context = [])
726726
'type' => $updateResultType,
727727
'args' => [
728728
'id' => ['type' => Type::int()],
729+
'key' => ['type' => Type::string()],
729730
'fullpath' => ['type' => Type::string()],
730731
'parentId' => ['type' => Type::int()],
731732
'defaultLanguage' => ['type' => Type::string()],
@@ -882,6 +883,16 @@ public function getUpdateObjectResolver($processors, $localeService, $object = n
882883
$object->setOmitMandatoryCheck($args['omitMandatoryCheck']);
883884
}
884885

886+
if (isset($args['key'])) {
887+
if (!DataObject\Service::isValidKey($args['key'], AbstractObject::OBJECT_TYPE_OBJECT)) {
888+
return [
889+
'success' => false,
890+
'message' => '"key" is not valid',
891+
];
892+
}
893+
$object->setKey($args['key']);
894+
}
895+
885896
$tags = [];
886897
if (isset($args['input'])) {
887898
$dataIn = $args['input'];

0 commit comments

Comments
 (0)