Skip to content

Commit 75e3c67

Browse files
committed
The OrderFilter is still triggering bad deprecation/function calls
1 parent 2e0c647 commit 75e3c67

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Bridge/Doctrine/Orm/Filter/OrderFilter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ public function __construct(ManagerRegistry $managerRegistry, $requestStack = nu
8181
*/
8282
public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null, array $context = [])
8383
{
84+
if (isset($context['filters']) && !isset($context['filters'][$this->orderParameterName])) {
85+
return;
86+
}
87+
8488
if (!isset($context['filters'][$this->orderParameterName]) || !\is_array($context['filters'][$this->orderParameterName])) {
85-
$context['filters'] = null;
8689
parent::apply($queryBuilder, $queryNameGenerator, $resourceClass, $operationName, $context);
8790

8891
return;

tests/Bridge/Doctrine/Orm/Filter/OrderFilterTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,18 @@ public function provideApplyTestData(): array
341341
null,
342342
$orderFilterFactory,
343343
],
344+
'not having order should not throw a deprecation (select unchanged)' => [
345+
[
346+
'id' => null,
347+
'name' => null,
348+
],
349+
[
350+
'name' => 'q',
351+
],
352+
sprintf('SELECT o FROM %s o', Dummy::class),
353+
null,
354+
$orderFilterFactory,
355+
],
344356
];
345357
}
346358
}

0 commit comments

Comments
 (0)