Pagination with related data

Is there a way to make listview pagination ignore related data? I have a “profile” which has a one-to-many relation to “tag”. Whenever there are more than one tag per profile, the pagination numbers get messed up.

I suppose there might be a way to set up a different query for the pager. But I do need to be able to filter on the tags.

You can try using distinct.

Please check the following wiki:

Drills : Search by a HAS_MANY relation in Yii 2.0 > LIMIT and ORDER

2 Likes

That did it. Thanks! It’s a very helpful wiki.

1 Like