created textsdepart graphql query
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
# route(path: String!): NodeInterface
|
# route(path: String!): NodeInterface
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
extend type Query {
|
||||||
|
textsdepart: [Textref]
|
||||||
|
}
|
||||||
|
|
||||||
extend type Query {
|
extend type Query {
|
||||||
textref(id: Int!): Textref
|
textref(id: Int!): Textref
|
||||||
}
|
}
|
||||||
|
|||||||
+28
@@ -29,6 +29,8 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
|
|
||||||
$this->addRouteResolver($registry, $builder);
|
$this->addRouteResolver($registry, $builder);
|
||||||
|
|
||||||
|
$this->addTextsdepart($registry, $builder);
|
||||||
|
|
||||||
$this->addTextref($registry, $builder);
|
$this->addTextref($registry, $builder);
|
||||||
|
|
||||||
$this->addTextprod($registry, $builder);
|
$this->addTextprod($registry, $builder);
|
||||||
@@ -104,6 +106,32 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// _____ _ ___ _
|
||||||
|
// |_ _|____ _| |_ ___ | \ ___ _ __ __ _ _ _| |_
|
||||||
|
// | |/ -_) \ / _(_-< | |) / -_) '_ \/ _` | '_| _|
|
||||||
|
// |_|\___/_\_\\__/__/ |___/\___| .__/\__,_|_| \__|
|
||||||
|
// |_|
|
||||||
|
protected function addTextsdepart(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
|
||||||
|
|
||||||
|
$registry->addFieldResolver('Query', 'textsdepart',
|
||||||
|
$builder->compose(
|
||||||
|
$builder->callback(function($parent, $arg){
|
||||||
|
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||||
|
$query = $entity_storage->getQuery()
|
||||||
|
->condition('type', 'texte')
|
||||||
|
->condition('field_famille', 9)
|
||||||
|
->accessCheck(TRUE);
|
||||||
|
$results = $query->execute();
|
||||||
|
return $results;
|
||||||
|
}),
|
||||||
|
$builder->produce('entity_load_multiple')
|
||||||
|
->map('type', $builder->fromValue('node'))
|
||||||
|
->map('ids', $builder->fromParent())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// _____ _ __
|
// _____ _ __
|
||||||
// |_ _|____ _| |_ _ _ ___ / _|
|
// |_ _|____ _| |_ _ _ ___ / _|
|
||||||
// | |/ -_) \ / _| '_/ -_) _|
|
// | |/ -_) \ / _| '_/ -_) _|
|
||||||
|
|||||||
Reference in New Issue
Block a user