Skip to content

Commit 42d3523

Browse files
authored
Don't apply join when DateFilter has no actual filter values submitted
Due to how it is implemented, DateFilter applies an inner join on nested properties even if no filters are provided. This is a problem for GraphQL where you have to define your variables for the query upfront, so ApiPlatform sees the filter in the query and applies the join, but no actual fields and filtering value is supplied
1 parent de3bed2 commit 42d3523

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Doctrine/Orm/Filter/DateFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function filterProperty(string $property, $values, QueryBuilder $query
153153
$alias = $queryBuilder->getRootAliases()[0];
154154
$field = $property;
155155

156-
if ($this->isPropertyNested($property, $resourceClass)) {
156+
if ($this->isPropertyNested($property, $resourceClass) && count($values) > 0) {
157157
[$alias, $field] = $this->addJoinsForNestedProperty($property, $alias, $queryBuilder, $queryNameGenerator, $resourceClass, Join::INNER_JOIN);
158158
}
159159

0 commit comments

Comments
 (0)