Kaynağa Gözat

gql added id and revision_id to entite parga in concernement

bach 7 ay önce
ebeveyn
işleme
559e93a6e5

+ 2 - 0
src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls

@@ -38,6 +38,8 @@ type Entiteintegre {
   actuelfuture: Int
   menacemaintien: Float
   prise: Float
+  id: Int
+  revision_id: Int
 }
 
 type Entite implements NodeInterface {

+ 14 - 0
src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php

@@ -346,7 +346,21 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
             }
           })
       ));
+    
+    $registry->addFieldResolver('Entiteintegre', 'id',
+      $builder->produce('entity_id')
+        ->map('entity', $builder->fromParent())
+      );
 
+    $registry->addFieldResolver('Entiteintegre', 'revision_id',
+      $builder->compose(
+        $builder->callback(function($parent, $arg){
+          $revid = $parent->getRevisionId();
+          return $revid;
+        })
+      )
+    );
+    
     $registry->addFieldResolver('Entiteintegre', 'actuelfuture',
       $builder->produce('property_path')
         ->map('type', $builder->fromValue('entity:paragraph'))