gql paragraph id

This commit is contained in:
Bachir Soussi Chiadmi 2024-03-27 17:09:23 +01:00
parent 387d6e7aac
commit 4744496526
2 changed files with 16 additions and 4 deletions

View File

@ -63,6 +63,7 @@ type Entite implements NodeInterface {
}
type Source {
id: Int!
audios: [Filefield]
date: Date
documents: [Filefield]

View File

@ -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')