Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-303: Change DataProvider priority #248

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'] ?? [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition seems wrong. It rather should be [] !== ($facet['buckets'] ?? []). I'm facing the issue related to this, I guess:

Warning: Undefined array key \u0022buckets\u0022 in \/srv\/sylius\/vendor\/bitbag\/elasticsearch-plugin\/src\/Api\/Resolver\/FacetsResolver.php line 51

});
}
}
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
Loading