-
-
Notifications
You must be signed in to change notification settings - Fork 928
feat(doctrine): new iri search filters #7121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(doctrine): new iri search filters #7121
Conversation
0271e3e
to
774ba0c
Compare
8322356
to
773ce67
Compare
ae2ad0e
to
662ad04
Compare
continues the work at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865
Continues the work at api-platform#7079 and before at api-platform#6865 See api-platform#6971.
Continues the work at api-platform#7079 and before at api-platform#6865 See api-platform#6971.
662ad04
to
f6bbe8b
Compare
Continues the work at api-platform#7079 and before at api-platform#6865 See api-platform#6971.
Continues the work at api-platform#7079 and before at api-platform#6865 See api-platform#6971.
Continues the work at api-platform#7079 and before at api-platform#6865
return; | ||
} | ||
|
||
$values = (array) $parameter->getValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now castToArray
therefore we don't really need to cast here, however we may need to fix how we build our aggregation see below
use ApiPlatform\OpenApi\Model\Parameter as OpenApiParameter; | ||
|
||
/** | ||
* @author Vincent Amstoutz <[email protected]> |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
return new OpenApiParameter(name: $parameter->getKey().'[]', in: 'query', style: 'deepObject', explode: true); | ||
} | ||
|
||
public function getDescription(string $resourceClass): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this method to a trait inside Metadata, also add * @deprecated in 4.2, to be removed in 5.0
to the Metadata\FilterInterface (we'll handle the bc later)
$aggregationBuilder | ||
->match() | ||
->field($property) | ||
->in($values); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$aggregationBuilder | |
->match() | |
->field($property) | |
->in($values); | |
$aggregationBuilder | |
->match() | |
->field($property) | |
->{(is_iterable($value)) ? 'in' : 'equals'}($parameter->getValue()); |
|
||
$value = $parameter->getValue(); | ||
if (!\is_array($value)) { | ||
$value = [$value]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is now castToArray therefore we don't really need to cast here, however we may need to fix how we build our aggregation see below
#[ODM\Document] | ||
class Company | ||
{ | ||
#[ODM\Id(strategy: 'INCREMENT', type: 'int')] | ||
#[ODM\Id(type: 'int', strategy: 'INCREMENT')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
*/ | ||
protected function setUp(): void | ||
{ | ||
self::$alwaysBootKernel = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected static ?bool $alwaysBootKernel = false;
'expectedNames' => ['Gertrude'], | ||
]; | ||
|
||
yield 'filtre par ID du poulailler de Henriette' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the API Platform code base is in english :p
* @throws ServerExceptionInterface | ||
*/ | ||
#[DataProvider('filterDataProvider')] | ||
public function testOrFilter(string $url, int $expectedCount, array $expectedNames): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this correctly tests an Or filter
*/ | ||
protected function setUp(): void | ||
{ | ||
self::$alwaysBootKernel = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected static ?bool $alwaysBootKernel = false;
main
The aim of this PR is to have the API Platform search filters like API Platform eloquent filters.
This PR continues the improvements initiated in pull requests #7079 and #6865, aiming to finalize the efforts started initially in pull request #6775.
TODO (by order of priority) :