Skip to content

Commit

Permalink
#1242562 [Elasticsearch] Prevent automatic ES requests during model A…
Browse files Browse the repository at this point in the history
…PI calls
  • Loading branch information
rbayet authored and botisSmile committed Jul 20, 2023
1 parent eb56b35 commit ada18d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@
"patches": {
"lexik/jwt-authentication-bundle": {
"Fix forward port of trait that does not preload correctly": "patches/jwt-authenticator.patch"
},
"api-platform/core": {
"Fix Elasticsearch bridge data providers enabled by default": "patches/api-platform-elasticsearch-bridge.patch"
}
}
}
Expand Down
26 changes: 26 additions & 0 deletions api/patches/api-platform-elasticsearch-bridge.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/Bridge/Elasticsearch/DataProvider/CollectionDataProvider.php b/src/Bridge/Elasticsearch/DataProvider/CollectionDataProvider.php
index b69f0083a..e410c10bd 100644
--- a/src/Bridge/Elasticsearch/DataProvider/CollectionDataProvider.php
+++ b/src/Bridge/Elasticsearch/DataProvider/CollectionDataProvider.php
@@ -64,7 +64,7 @@ final class CollectionDataProvider implements ContextAwareCollectionDataProvider
{
try {
$resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
- if (false === $resourceMetadata->getCollectionOperationAttribute($operationName, 'elasticsearch', true, true)) {
+ if (false === $resourceMetadata->getCollectionOperationAttribute($operationName, 'elasticsearch', false, true)) {
return false;
}
} catch (ResourceClassNotFoundException $e) {
diff --git a/src/Bridge/Elasticsearch/DataProvider/ItemDataProvider.php b/src/Bridge/Elasticsearch/DataProvider/ItemDataProvider.php
index 9d3fcb1c7..4cce1b9a2 100644
--- a/src/Bridge/Elasticsearch/DataProvider/ItemDataProvider.php
+++ b/src/Bridge/Elasticsearch/DataProvider/ItemDataProvider.php
@@ -58,7 +58,7 @@ final class ItemDataProvider implements ItemDataProviderInterface, RestrictedDat
{
try {
$resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
- if (false === $resourceMetadata->getItemOperationAttribute($operationName, 'elasticsearch', true, true)) {
+ if (false === $resourceMetadata->getItemOperationAttribute($operationName, 'elasticsearch', false, true)) {
return false;
}
} catch (ResourceClassNotFoundException $e) {

0 comments on commit ada18d7

Please sign in to comment.