K
K
knowledge2019-04-19 13:56:17
Yii
knowledge, 2019-04-19 13:56:17

How to do such search on related table in Gridview?

I have a Users table
AND a Games table.
They have a relationship, but there is no games column in the Users table, there is no way to make it, Users is from a vendor, the relationship is described only in models as hasOne. There is a user_id field in the Games table
How can I make a filter in Gridview Users by whether there are entries about Users in Games or not
I understand correctly that specifying attributes asc desc does not work here, a different approach is needed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Moses Fender, 2019-04-19
@mosesfender

Users from the vendor, the relationship is only described in models as hasOne

1. For searching, filtering, sorting, they usually use a successor, in this case, UsersSearch for ActiveDataProvider.
2. There you are free to write any connections you like.
3. There you can remake the request a hundred times more than the previous one with the most intricate filters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question