Skip to content

Allow sort to accept expressions #248

@trifox83

Description

@trifox83

Proposed new feature or change

I'm trying to sort a column by custom sort order via expression.

$expression = "FIELD(country_code, '" . $fields . "')");

return Sort::only([
    'country_code' => [
        'asc'  => [$expression => SORT_ASC],
        'desc' => [$expression => SORT_DESC],
    ],
]);

But \Yiisoft\Data\Reader\Sort::only() does not accept expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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