From 559e93a6e59192f15f0e0c885253eaa036335283 Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 4 Apr 2024 17:31:11 +0200 Subject: [PATCH] gql added id and revision_id to entite parga in concernement --- .../graphql/ouatt_extension.base.graphqls | 2 ++ .../SchemaExtension/OuattSchemaExtension.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls index f224f47..e197180 100644 --- a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls +++ b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls @@ -38,6 +38,8 @@ type Entiteintegre { actuelfuture: Int menacemaintien: Float prise: Float + id: Int + revision_id: Int } type Entite implements NodeInterface { diff --git a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php index 53367b0..2137567 100644 --- a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php +++ b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php @@ -346,7 +346,21 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { } }) )); + + $registry->addFieldResolver('Entiteintegre', 'id', + $builder->produce('entity_id') + ->map('entity', $builder->fromParent()) + ); + $registry->addFieldResolver('Entiteintegre', 'revision_id', + $builder->compose( + $builder->callback(function($parent, $arg){ + $revid = $parent->getRevisionId(); + return $revid; + }) + ) + ); + $registry->addFieldResolver('Entiteintegre', 'actuelfuture', $builder->produce('property_path') ->map('type', $builder->fromValue('entity:paragraph'))