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 1d2723a..abd7522 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 @@ -25,6 +25,7 @@ type Concernement implements NodeInterface { entites: [Entiteintegre] besoins: [Besoin] doleances: [Doleance] + revisions: [Concernement] } type Entiteintegre { 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 a2f51a3..c107cfd 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 @@ -297,9 +297,16 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { // revisions: [Concernement] $registry->addFieldResolver('Concernement', 'revisions', - $builder->produce('entity_reference') - ->map('entity', $builder->fromParent()) - ->map('field', $builder->fromValue('field_doleancer')) + $builder->compose( + $builder->callback(function($parent, $arg){ + $vids = \Drupal::entityTypeManager()->getStorage('node')->revisionIds($parent); + $revisions = []; + foreach($vids as $vid){ + $revisions[] = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($vid); + } + return $revisions; + }) + ) ); }