-
-
Notifications
You must be signed in to change notification settings - Fork 958
test: add nested property test for uuidfilter #7668
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
Draft
aaa2000
wants to merge
1
commit into
api-platform:main
Choose a base branch
from
aaa2000:add-test-for-uuid-filter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,14 @@ | |
| 'myDevice' => new QueryParameter( | ||
| filter: new UuidFilter(), | ||
| ), | ||
| 'myDevice.externalId' => new QueryParameter( | ||
| filter: new UuidFilter(), | ||
| property: 'myDevice.externalId', | ||
| ), | ||
| 'name_converted.name_converted' => new QueryParameter( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a third filter ? Cause the key here is just a "name" for the filter no ? It shouldn't have any impact on the query and therefor a camelCase key should be allowed too no ?) (In the same idea than #7667) |
||
| filter: new UuidFilter(), | ||
| property: 'nameConverted.nameConverted', | ||
| ), | ||
| ] | ||
| ), | ||
| new Post(), | ||
|
|
@@ -47,9 +55,13 @@ class RamseyUuidDeviceEndpoint | |
| #[ORM\ManyToOne] | ||
| public ?RamseyUuidDevice $myDevice = null; | ||
|
|
||
| public function __construct(?UuidInterface $id = null, ?RamseyUuidDevice $myDevice = null) | ||
| #[ORM\ManyToOne] | ||
| public ?RamseyUuidDevice $nameConverted = null; | ||
|
|
||
| public function __construct(?UuidInterface $id = null, ?RamseyUuidDevice $myDevice = null, ?RamseyUuidDevice $nameConverted = null) | ||
| { | ||
| $this->id = $id ?? Uuid::uuid7(); | ||
| $this->myDevice = $myDevice; | ||
| $this->nameConverted = $nameConverted; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You give the property here while you didn't have the need for
for instance ; is it needed ?
We could have a test with something like
no ?
Same for nameConverted like
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.
Without the property, I have the error
I put it in the draft because of that, I'd like to investigate why?
Yes, I can add a test for
and
But, I think that with
nameConverted.nameConverted, the query parameter will benameConverted.nameConvertedand notname_converted.name_converted....Uh oh!
There was an error while loading. Please reload this page.
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 is maybe the same issue than the one I found in my draft or a related one #7667 ?
You could try removing these lines
https://github.com/api-platform/core/pull/7667/files#diff-5e7788e120b00f67edb2447978c868aac8c117f505e150dbf859f603581a9c55L262-L264
to see if it works better for you without the property (?)
But sure your investigation will be interesting ^^