added new fields (actuel/futur, prise, maintien/menace, recit) to graphql

This commit is contained in:
Bachir Soussi Chiadmi 2022-10-18 11:07:10 +02:00
parent 73b6d007f4
commit 8d23ed82b8
4 changed files with 35 additions and 9 deletions

View File

@ -10,7 +10,7 @@ field_name: field_menace_maintien_degres
entity_type: paragraph entity_type: paragraph
bundle: entite_concernement bundle: entite_concernement
label: 'Menace - Maintien' label: 'Menace - Maintien'
description: '' description: 'between -90 to 90'
required: false required: false
translatable: false translatable: false
default_value: default_value:

View File

@ -10,7 +10,7 @@ field_name: field_prise
entity_type: paragraph entity_type: paragraph
bundle: entite_concernement bundle: entite_concernement
label: Prise label: Prise
description: '' description: 'between 0 to 100'
required: false required: false
translatable: false translatable: false
default_value: default_value:

View File

@ -13,13 +13,15 @@ type Concernement implements NodeInterface {
path: String! path: String!
author: String author: String
texte: String texte: String
recit: Filefield
entites: [Entiteintegre] entites: [Entiteintegre]
} }
type Entiteintegre { type Entiteintegre {
entite: Entite entite: Entite
rayon: Float actuelfuture: Int
angle: Float menacemaintien: Float
prise: Float
} }
type Entite implements NodeInterface { type Entite implements NodeInterface {
@ -31,7 +33,7 @@ type Entite implements NodeInterface {
author: String author: String
texte: String texte: String
images: [Image] images: [Image]
fichiers: [File] fichiers: [Filefield]
liens: [Link] liens: [Link]
} }

View File

@ -173,6 +173,23 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
->map('entity', $builder->fromParent()) ->map('entity', $builder->fromParent())
)); ));
// $registry->addFieldResolver('Concernement', 'recit',
// $builder->produce('entity_reference')
// ->map('entity', $builder->fromParent())
// ->map('field', $builder->fromValue('field_recit'))
// );
$registry->addFieldResolver('Concernement', 'recit',
$builder->compose(
$builder->produce('property_path')
->map('type', $builder->fromValue('entity:node'))
->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_recit')),
$builder->produce('seek')
->map('input', $builder->fromParent())
->map('position', $builder->fromValue(0))
));
$registry->addFieldResolver('Concernement', 'entites', $registry->addFieldResolver('Concernement', 'entites',
$builder->produce('entity_reference_revisions') $builder->produce('entity_reference_revisions')
->map('entity', $builder->fromParent()) ->map('entity', $builder->fromParent())
@ -198,18 +215,25 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
}) })
)); ));
$registry->addFieldResolver('Entiteintegre', 'rayon', $registry->addFieldResolver('Entiteintegre', 'actuelfuture',
$builder->produce('property_path') $builder->produce('property_path')
->map('type', $builder->fromValue('entity:paragraph')) ->map('type', $builder->fromValue('entity:paragraph'))
->map('value', $builder->fromParent()) ->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_rayon.value')) ->map('path', $builder->fromValue('field_actuel_future.value'))
); );
$registry->addFieldResolver('Entiteintegre', 'angle', $registry->addFieldResolver('Entiteintegre', 'menacemaintien',
$builder->produce('property_path') $builder->produce('property_path')
->map('type', $builder->fromValue('entity:paragraph')) ->map('type', $builder->fromValue('entity:paragraph'))
->map('value', $builder->fromParent()) ->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_angle.value')) ->map('path', $builder->fromValue('field_menace_maintien_degres.value'))
);
$registry->addFieldResolver('Entiteintegre', 'prise',
$builder->produce('property_path')
->map('type', $builder->fromValue('entity:paragraph'))
->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_prise.value'))
); );
} }