Skip to content

Conversation

@lyrixx
Copy link
Contributor

@lyrixx lyrixx commented Oct 30, 2024

Q A
Branch? main
Tickets
License MIT
Doc PR

I noticed there are many places where APIP fails silently. This make our code harder to debug.

I don't know if this is a feature, or just a mistake. If it's a mistake, I'll try to send more PR.

@lyrixx lyrixx force-pushed the dx-exception-on-invalid-filter branch 2 times, most recently from 9ca6057 to f20ac7a Compare October 30, 2024 17:40
if ($filter instanceof FilterInterface) {
$filter->apply($queryBuilder, $queryNameGenerator, $resourceClass, $operation, ['filters' => $values, 'parameter' => $parameter] + $context);
if (!$filter instanceof FilterInterface) {
throw new \InvalidArgumentException(\sprintf('Could not find filter "%s" for parameter "%s" in operation "%s" for resource "%s".', $filterId, $parameter->getKey(), $operation?->getShortName(), $resourceClass));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the exception be from ApiPlatform\Metadata\Exception please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

@lyrixx lyrixx force-pushed the dx-exception-on-invalid-filter branch from f20ac7a to dfac68c Compare November 4, 2024 13:14
@soyuka soyuka changed the base branch from main to 3.4 November 4, 2024 13:38
@soyuka soyuka force-pushed the dx-exception-on-invalid-filter branch from dfac68c to 667d779 Compare November 4, 2024 13:40
@soyuka soyuka changed the title DX: throw an exception when a filter is not found in a parameter fix(doctrine): throw an exception when a filter is not found in a parameter Nov 4, 2024
@soyuka soyuka merged commit 2f967d9 into api-platform:3.4 Nov 4, 2024
78 checks passed
@soyuka
Copy link
Member

soyuka commented Nov 4, 2024

I think that we should fix that inside Doctrine ODM as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants