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 c482971..02f8c7f 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 @@ -63,6 +63,7 @@ type Entite implements NodeInterface { } type Source { + id: Int! audios: [Filefield] date: Date documents: [Filefield] 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 896ab61..373449e 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 @@ -595,6 +595,10 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { // |____/ \___/ \__,_|_| \___\___| protected function addSource(ResolverRegistryInterface $registry, ResolverBuilder $builder) { + $registry->addFieldResolver('Source', 'id', + $builder->produce('entity_id') + ->map('entity', $builder->fromParent()) + ); $registry->addFieldResolver('Source', 'description', $builder->produce('property_path') @@ -603,11 +607,18 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { ->map('path', $builder->fromValue('field_description.value')) ); + // $registry->addFieldResolver('Source', 'images', + // $builder->produce('entity_reference') + // ->map('entity', $builder->fromParent()) + // ->map('field', $builder->fromValue('field_images')) + // ); + // images: [Image] $registry->addFieldResolver('Source', 'images', - $builder->produce('entity_reference') - ->map('entity', $builder->fromParent()) - ->map('field', $builder->fromValue('field_images')) - ); + $builder->produce('property_path') + ->map('type', $builder->fromValue('entity:paragraph')) + ->map('value', $builder->fromParent()) + ->map('path', $builder->fromValue('field_images')) + ); $registry->addFieldResolver('Source', 'videos', $builder->produce('property_path')