Remove prefixed items from additional data
This commit is contained in:
parent
fd52cdc45f
commit
ddbd03388e
1 changed files with 9 additions and 1 deletions
|
@ -149,7 +149,15 @@ class Mapper
|
|||
$fields['data'] = [
|
||||
'type' => Type::string(),
|
||||
'description' => 'Additional data',
|
||||
'resolve' => static fn($object, $args, $context, $info) => \json_encode($object, JSON_FORCE_OBJECT),
|
||||
'resolve' => static function ($object, $args, $context, $info) {
|
||||
$data = \array_filter(
|
||||
$object,
|
||||
fn($key) => !\str_starts_with($key, '_'),
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
|
||||
return \json_encode($data, JSON_FORCE_OBJECT);
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue