V
V
Vlad Osadchyi2018-11-17 17:39:25
Yii
Vlad Osadchyi, 2018-11-17 17:39:25

How to filter by parameters of another model in GridView?

There are two tables Posts (id, name, author_id) and Hashtags (id, hashtag, post_id). Since a post can have multiple hashtags, I store the hashtags of a post in a separate table. Made models through Gii. It is necessary to make it possible to filter posts by hashtag in the GridView in the Posts model view. How to implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-11-18
@VladOsadchyi

I recommend to disassemble this article:
https://www.yiiframework.com/wiki/851/yii2-gridvie...
There is just an example with hasMany
B to catch up:
https://www.yiiframework.com/wiki/780/ drills-searc... (here are more examples, I think it will be interesting to finally understand the searchModel)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question