Skip to content

Commit

Permalink
Merge pull request #248 from BitBagCommerce/op-303-api-support
Browse files Browse the repository at this point in the history
OP-303: Change DataProvider priority
  • Loading branch information
senghe authored Jun 28, 2024
2 parents 78fbc07 + f876703 commit a4dd35a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/Api/Resolver/FacetsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function resolve(array $data): array
return [];
}

return $adapter->getAggregations();
return array_filter($adapter->getAggregations(), function ($facet) {
return [] !== $facet['buckets'] ?? [];
});
}
}
2 changes: 1 addition & 1 deletion src/Resources/config/services/api/data_provider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<argument type="service" id="bitbag_sylius_elasticsearch_plugin.api.request_data_handler" />
<argument type="service" id="bitbag_sylius_elasticsearch_plugin.finder.search_products" />
<argument type="service" id="bitbag_sylius_elasticsearch_plugin.api.resolver.facets" />
<tag name="api_platform.collection_data_provider" />
<tag name="api_platform.collection_data_provider" priority="10" />
</service>
</services>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
}
],
"facets": {
"price": {
"buckets": []
},
"taxon": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
}
]
},
"price": {
"buckets": []
},
"taxon": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
}
]
},
"price": {
"buckets": []
},
"taxon": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
Expand Down

0 comments on commit a4dd35a

Please sign in to comment.