@@ -89,7 +89,7 @@ public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $q
89
89
// Problem: too hard to add the joins from the extensions and correctly initialize the QueryNameGenerator
90
90
// Workaround may fail if extensions did any joins and filters also, or if both use the QueryNameGenerator
91
91
92
- $ filters = $ this ->getFilters ($ resourceClass , $ operationName , true );
92
+ $ filters = $ this ->getFilters ($ resourceClass , $ operationName , true );
93
93
foreach ($ filters as $ filter ) {
94
94
$ filter ->apply ($ newQb , $ newQng , $ resourceClass , $ operationName , $ context );
95
95
}
@@ -154,7 +154,7 @@ public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $q
154
154
throw new \RuntimeException ("Could not replace criteria from filters " );
155
155
}
156
156
157
- /**
157
+ /**
158
158
* @return array of Doctrine\ORM\Query\Expr\* and/or string (DQL),
159
159
* each of which must be self-contained in the sense that the intended
160
160
* logic is not compromised if it is combined with the others and other
@@ -183,6 +183,9 @@ public function generateExpressions(QueryBuilder $queryBuilder, QueryNameGenerat
183
183
*/
184
184
protected function doGenerate ($ queryBuilder , $ queryNameGenerator , $ resourceClass , $ operationName , $ context )
185
185
{
186
+ if (empty ($ context ['filters ' ])) {
187
+ return [];
188
+ }
186
189
$ oldWhere = $ queryBuilder ->getDQLPart ('where ' );
187
190
188
191
// replace by marker expression
@@ -347,7 +350,7 @@ protected function replaceInnerJoinsByLeftJoins(QueryBuilder $queryBuilder) {
347
350
$ joinExp ->getConditionType (),
348
351
$ joinExp ->getCondition (),
349
352
$ joinExp ->getIndexBy ()
350
- );
353
+ );
351
354
} else {
352
355
$ result [$ rootAlias ][$ i ] = $ joinExp ;
353
356
}
0 commit comments