Skip to content

Commit 7785241

Browse files
committed
400 when attempting to filter on an attribute of a polymorphic relationship
1 parent a72bcff commit 7785241

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ResourceType.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,12 @@ public function applyFilters($query, array $filters, Context $context): void
157157
$this->adapter->filterByRelationship($query, $field, function ($query) use ($relatedResource, $sub, $value, $context) {
158158
$relatedResource->applyFilters($query, [($sub ?? 'id') => $value], $context);
159159
});
160+
161+
continue;
160162
}
161-
continue;
163+
164+
throw (new BadRequestException('Cannot filter on attribute of polymorphic relationship: '.$name))
165+
->setSourceParameter("filter[$name]");
162166
}
163167
}
164168

0 commit comments

Comments
 (0)