Skip to content

Commit 0bb232b

Browse files
committed
Make ParameterExtension context more generic
1 parent 6b89e4f commit 0bb232b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/Doctrine/Odm/Extension/ParameterExtension.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,10 @@ private function applyFilter(Builder $aggregationBuilder, ?string $resourceClass
8989
$filter->setProperties($properties ?? []);
9090
}
9191

92-
$filterContext = ['filters' => $values, 'parameter' => $parameter, 'match' => $context['match'] ?? null, 'search' => $context['search'] ?? null];
92+
$specificContext = ['filters' => $values, 'parameter' => $parameter];
93+
$filterContext = array_replace($context, $specificContext);
9394
$filter->apply($aggregationBuilder, $resourceClass, $operation, $filterContext);
94-
// update by reference
95-
if (isset($filterContext['mongodb_odm_sort_fields'])) {
96-
$context['mongodb_odm_sort_fields'] = $filterContext['mongodb_odm_sort_fields'];
97-
}
98-
if (isset($filterContext['match'])) {
99-
$context['match'] = $filterContext['match'];
100-
}
101-
if (isset($filterContext['search'])) {
102-
$context['search'] = $filterContext['search'];
103-
}
95+
$context = array_replace($context, array_diff_key($filterContext, $specificContext));
10496
}
10597

10698
if (isset($context['match'])) {

0 commit comments

Comments
 (0)