OrFilter with nullable nested relation
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 54/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- php
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start by tracing how FreeTextQueryFilter, OrFilter and PartialSearchFilter build joins for nested properties, then inspect the relevant filter tests for nullable relations. Reproduce the example with a nullable relation and a matching scalar field. Done means the root resource is still returned when the scalar field matches, while nested-property matching continues to work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
API Platform version(s) affected: 4.4.3
Description
When using FreeTextQueryFilter together with OrFilter(new PartialSearchFilter()), nested relational properties are joined with INNER JOIN.
This becomes a problem when one of these relations is nullable.
Because of the INNER JOIN, root resources are excluded from the result set before the OR conditions are evaluated. As a result, an entity can fail to match even if one of its direct scalar fields does match the search term.
Example
I have a User resource with this parameter:
#[QueryParameter(
key: 'search',
filter: new FreeTextQueryFilter(new OrFilter(new PartialSearchFilter())),
properties: ['name', 'internalPhone', 'externalPhone', 'department.name', 'service.name', 'job.title']
)]
Some relations such as service, department, or job are nullable.
Example data:
-
User A:
- name = "John Doe"
- service = null
-
User B:
- name = "Other User"
- service.name = "IT"
Request
GET /users?search=john
Actual behavior
User A is not returned, even though name matches "john".
This appears to happen because nested properties like service.name are joined using INNER JOIN, so users with service = null are removed from the query result before the OR expression is applied.
Expected behavior
For nullable relations, nested properties used by text search should not exclude the root entity when the relation is null.
In this case, we would expect a LEFT JOIN so that:
name LIKE '%john%'
OR internalPhone LIKE ...
OR externalPhone LIKE ...
OR service.name LIKE ...
etc.
can still match on direct fields even if a nullable relation is absent.
How to reproduce
Possible Solution ``
Additional Context
- Ngôn ngữ chính
- PHP
- Star
- 2.6k
- Fork
- 987
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 76
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của api-platform/core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
api-platform/core#8665 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Doctrine\Orm\OrderExtension fails on SortDirectionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
api-platform/core#8660 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DeserializeProvider calls PartialDenormalizationException::getErrors(), deprecated in Symfony 8.1Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
api-platform/core#8650 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
api-platform/core#8649 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`OrderExtension` and `OrderFilter` pass string sort directions, deprecated since `doctrine/orm` 3.7Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
api-platform/core#8648 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của api-platform/core
Issue tương tự
-
No Code Attached Yet
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
joomla/joomla-cms#48611 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Automattic/safe-publish#716 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FrameworkBundle][SecurityBundle] Make `KernelBrowser::loginUser()` wor…Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởFrameworkBundle SecurityBundle
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23277 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Sync EN] hard link does not need special permissionsCó thể đã có người làm @lacatoire đã nhận hôm nay. Đang mởsync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày