gql query alltags
This commit is contained in:
@@ -46,6 +46,10 @@ extend type Query {
|
||||
famille(id: Int!): Taxoterm
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
alltags: [Taxoterm]
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
tag(id: Int!): Taxoterm
|
||||
}
|
||||
|
||||
+16
@@ -815,6 +815,22 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
||||
// |_|\__,_\__, |
|
||||
// |___/
|
||||
protected function addTaxoterm(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
|
||||
$registry->addFieldResolver('Query', 'alltags',
|
||||
$builder->compose(
|
||||
$builder->callback(function($parent, $arg){
|
||||
$entity_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
|
||||
$query = $entity_storage->getQuery()
|
||||
->condition('vid', ['tags', 'tag_prod'], 'IN')
|
||||
->accessCheck(TRUE);
|
||||
$results = $query->execute();
|
||||
return $results;
|
||||
}),
|
||||
$builder->produce('entity_load_multiple')
|
||||
->map('type', $builder->fromValue('taxonomy_term'))
|
||||
->map('ids', $builder->fromParent())
|
||||
)
|
||||
);
|
||||
|
||||
$registry->addFieldResolver('Query', 'tag',
|
||||
$builder->produce('entity_load')
|
||||
->map('type', $builder->fromValue('taxonomy_term'))
|
||||
|
||||
Reference in New Issue
Block a user