Yii Framework Forum

Pagination with related data

(Steve) #1

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.

(Softark) #2

You can try using distinct.

Please check the following wiki:

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

(Steve) #3

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