refactored loadMaterials vuex mixins with graphql
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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'))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ___ _
|
||||
// / __| __ _ _ __ _ __| |___
|
||||
// \__ \/ _` | ' \| '_ \ / -_)
|
||||
|
Reference in New Issue
Block a user