gql creation

This commit is contained in:
2021-05-18 23:04:17 +02:00
parent 9fadf56a13
commit c8af50451c
2 changed files with 23 additions and 0 deletions
@@ -75,6 +75,9 @@ type Creation implements NodeInterface {
texte: String
auteurs: [Auteur]
oeuvre: Link
date: Date # field_date
rebonds: [Creation] # field_rebonds
texte_de_depart: [Textref] # field_texte_de_depart
}
interface NoteInterface {
@@ -610,6 +610,26 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
->map('path', $builder->fromValue('field_oeuvre'))
);
$registry->addFieldResolver('Creation', 'rebonds',
$builder->compose(
$builder->produce('entity_reference')
->map('entity', $builder->fromParent())
->map('field', $builder->fromValue('field_rebonds'))
));
$registry->addFieldResolver('Creation', 'texte_de_depart',
$builder->compose(
$builder->produce('entity_reference')
->map('entity', $builder->fromParent())
->map('field', $builder->fromValue('field_texte_de_depart'))
));
$registry->addFieldResolver('Creation', 'date',
$builder->produce('property_path')
->map('type', $builder->fromValue('entity:node'))
->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_date'))
);
}
// ___ _