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
bundle: entite_concernement
label: 'Menace - Maintien'
description: ''
description: 'between -90 to 90'
required: false
translatable: false
default_value:

View File

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

View File

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

View File

@ -173,6 +173,23 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
->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',
$builder->produce('entity_reference_revisions')
->map('entity', $builder->fromParent())
@ -198,19 +215,26 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
})
));
$registry->addFieldResolver('Entiteintegre', 'rayon',
$registry->addFieldResolver('Entiteintegre', 'actuelfuture',
$builder->produce('property_path')
->map('type', $builder->fromValue('entity:paragraph'))
->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')
->map('type', $builder->fromValue('entity:paragraph'))
->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'))
);
}
// _____ _ _ _