refactored loadMaterials vuex mixins with graphql

This commit is contained in:
2020-12-23 18:05:25 +01:00
parent 665a550748
commit 53dcc8b854
15 changed files with 182 additions and 90 deletions

View File

@@ -2,6 +2,10 @@ extend type Query {
materiau(id: Int!): Materiau
}
extend type Query {
materiaux(ids: [Int]): [Materiau]
}
extend type Query {
article(id: Int!): Article
}

View File

@@ -71,6 +71,13 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
->map('id', $builder->fromArgument('id'))
);
$registry->addFieldResolver('Query', 'materiaux',
$builder->produce('entity_load_multiple')
->map('type', $builder->fromValue('node'))
// ->map('bundles', $builder->fromValue(['materiau']))
->map('ids', $builder->fromArgument('ids'))
);
$registry->addFieldResolver('Materiau', 'id',
$builder->produce('entity_id')
->map('entity', $builder->fromParent())
@@ -204,10 +211,8 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_samples'))
);
}
// ___ _
// / __| __ _ _ __ _ __| |___
// \__ \/ _` | ' \| '_ \ / -_)