-
-
Notifications
You must be signed in to change notification settings - Fork 949
fix: consistent :property placeholder behavior #7547
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
fix: consistent :property placeholder behavior #7547
Conversation
| use PHPUnit\Framework\Attributes\DataProvider; | ||
|
|
||
| /** | ||
| * @author Votre Nom <votre@email.com> |
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 need to replace it with your name and email
src/Metadata/Resource/Factory/ParameterResourceMetadataCollectionFactory.php
Outdated
Show resolved
Hide resolved
| properties: ['description', 'name'] | ||
| ), | ||
| ] | ||
| )] |
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.
can you add one to the https://github.com/api-platform/core/blob/main/tests/Fixtures/TestBundle/Entity/SearchFilterParameter.php class?
| $this->loadFixtures(); | ||
| } | ||
|
|
||
| #[DataProvider('partialFilterParameterProvider')] |
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.
please add these tests to the DoctrineTest file
src/Metadata/Resource/Factory/ParameterResourceMetadataCollectionFactory.php
Outdated
Show resolved
Hide resolved
8252ea7 to
c109c09
Compare
c109c09 to
a3313f5
Compare
Completes
This patch introduces a significant internal refactoring to how parameters are processed and applied to filters across API Platform's core, Doctrine, GraphQL, and Laravel integrations. The primary goal is to centralize and solidify parameter handling, particularly for filters that can operate on multiple properties using the
:propertyplaceholder.Filters will now receive a more precise context. During the
applymethod,$context['filters']will contain only the values directly relevant to the specific filter being processed. This simplifies filter implementation, and developers are encouraged to use$parameter->getValue()for direct access to their parameter's associated value.The
:propertyplaceholder in parameter keys is now integrates with thegetProperties()method ofPropertyAwareFilterInterfaceimplementations. This resolves previous inconsistencies and solidifies the behavior where:propertyplaceholders are dynamically expanded and filled with the content ofgetProperties, ensuring a more predictable and consistent approach for filters that target multiple properties.This is a risky change as it fundamentally alters how certain parameters, especially those using dynamic properties, are processed and how filters receive their values. The previous parameter handling, particularly concerning the interaction between
getPropertieson parameters and dynamic property expansion, was inconsistent and did not work properly in all scenarios. This patch solidifies that behavior.