|
@@ -154,11 +154,36 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
|
->map('id', $builder->fromArgument('id'))
|
|
|
);
|
|
|
|
|
|
+ $registry->addFieldResolver('Query', 'concernementrevisions',
|
|
|
+ $builder->compose(
|
|
|
+ $builder->produce('entity_load')
|
|
|
+ ->map('type', $builder->fromValue('node'))
|
|
|
+ ->map('id', $builder->fromArgument('id')),
|
|
|
+ $builder->callback(function($parent, $arg){
|
|
|
+ $vids = \Drupal::entityTypeManager()->getStorage('node')->revisionIds($parent);
|
|
|
+ $revisions = [];
|
|
|
+ foreach($vids as $vid){
|
|
|
+ $revisions[] = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($vid);
|
|
|
+ }
|
|
|
+ return $revisions;
|
|
|
+ })
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
$registry->addFieldResolver('Concernement', 'id',
|
|
|
$builder->produce('entity_id')
|
|
|
->map('entity', $builder->fromParent())
|
|
|
);
|
|
|
|
|
|
+ $registry->addFieldResolver('Concernement', 'revision_id',
|
|
|
+ $builder->compose(
|
|
|
+ $builder->callback(function($parent, $arg){
|
|
|
+ $revid = $parent->getRevisionId();
|
|
|
+ return $revid;
|
|
|
+ })
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
$registry->addFieldResolver('Concernement', 'uuid',
|
|
|
$builder->produce('entity_uuid')
|
|
|
->map('entity', $builder->fromParent())
|
|
@@ -269,6 +294,14 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
|
->map('entity', $builder->fromParent())
|
|
|
->map('field', $builder->fromValue('field_doleancer'))
|
|
|
);
|
|
|
+
|
|
|
+ // revisions: [Concernement]
|
|
|
+ $registry->addFieldResolver('Concernement', 'revisions',
|
|
|
+ $builder->produce('entity_reference')
|
|
|
+ ->map('entity', $builder->fromParent())
|
|
|
+ ->map('field', $builder->fromValue('field_doleancer'))
|
|
|
+ );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// _____ _ _ _ __ ___ _ __ __
|