gql userentites query
This commit is contained in:
parent
003acc36a3
commit
ab16a9f516
@ -27,6 +27,10 @@ extend type Query {
|
||||
entites(ids: [Int]): [Entite]
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
userentites(uid: Int!, time:String): [Entite]
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
entite(id: Int!): Entite
|
||||
}
|
||||
|
@ -421,6 +421,23 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
|
||||
)
|
||||
);
|
||||
|
||||
$registry->addFieldResolver('Query', 'userentites',
|
||||
$builder->compose(
|
||||
$builder->callback(function($parent, $arg){
|
||||
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||
$query = $entity_storage->getQuery()
|
||||
->condition('type', ['entite'], 'IN')
|
||||
->condition('uid', $arg['uid'])
|
||||
->accessCheck(TRUE);
|
||||
$results = $query->execute();
|
||||
return $results;
|
||||
}),
|
||||
$builder->produce('entity_load_multiple')
|
||||
->map('type', $builder->fromValue('node'))
|
||||
->map('ids', $builder->fromParent())
|
||||
)
|
||||
);
|
||||
|
||||
$registry->addFieldResolver('Query', 'entite',
|
||||
$builder->produce('entity_load')
|
||||
->map('type', $builder->fromValue('node'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user