Skip to content

Comparing with Null Values doesn't work with embeddables #4144

Description

@walva

API Platform version(s) affected: 2.6.x-dev and 2.6.3

Feature

Order Filter (Sorting) > Comparing with Null Values

Description
You cannot fine configure null value comparison strategy with embeddable.
✅ Adding an OrderFilter on an embeddable property does work as expected.

#[ApiFilter(OrderFilter::class, properties: [
    'embeddable.property'
])]

But trying to configure the option "nulls_comparaison", a QueryException exception is thrown. 🛑

#[ApiFilter(OrderFilter::class, properties: [
    'embeddable.property' => [
        'nulls_comparison' => OrderFilter::NULLS_LARGEST,
    ],
])]

How to reproduce

Repository to reproduce the issue

Given you add a OrderFilter to an embeddable property (eg: embeddable. property)
Wen configuring the nulls comparison strategy (eg: OrderFilter::NULLS_LARGEST)
And you navigate to the endpoint using the order query parameter (eg: sort[embeddable.property]
Then the collection is sorted properly
Instead, it throws a Doctrine\ORM\Query\QueryException

Possible Solution

Additional Context

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions