Skip to content

Conversation

@binaryk
Copy link
Collaborator

@binaryk binaryk commented Feb 11, 2021

Fixed

  • Sorting using BelongsTo field type. So now you can have:
// PostRepository

public static function sorts(): array
{
  return [
            'users.attributes.name' => SortableFilter::make()->setColumn('users.name')->usingBelongsTo(
                BelongsTo::make('user', 'user', UserRepository::class),
            )
 ];
}

And frontend can filter your posts by users.name using:

api/restify/posts?sort=users.attributes.name.

@binaryk binaryk merged commit 5515263 into 4.x Feb 11, 2021
@binaryk binaryk deleted the belongs-to-filter-fix branch February 11, 2021 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants