From c05abd7ce5b24239bda102e66acb5d3232e6b897 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 9 Mar 2021 11:53:59 +0100 Subject: [PATCH] added gql query text: Textinterface --- .../graphql/enfr_extension.extension.graphqls | 4 ++++ .../Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls b/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls index 848ebbe..8d81ef0 100644 --- a/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls +++ b/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls @@ -6,6 +6,10 @@ extend type Query { texts: [TextInterface] } +extend type Query { + text(id: Int!): TextInterface +} + extend type Query { textsdepart: [Textref] } diff --git a/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php b/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php index c42b339..349402c 100644 --- a/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php +++ b/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php @@ -142,6 +142,12 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase { ->map('ids', $builder->fromParent()) ) ); + + $registry->addFieldResolver('Query', 'text', + $builder->produce('entity_load') + ->map('type', $builder->fromValue('node')) + ->map('ids', $builder->fromParent()) + ); } // _____ _ ___ _