Answer the question
In order to leave comments, you need to log in
How to get data after filtering in yii2?
I just recently started learning yii2, so I have a few questions, probably quite simple ones.
I have a form for searching and the table itself for output (quite usual, made by CRUD)
I just need to take the results of filtering (WHERE condition1 AND condition2 AND condition3 ...;)
and put in my custom Postgres SELECT query
SELECT k, COUNT (*)
FROM TableName
JOIN jsonb_object_keys(data) as k on true
WHERE
condition1
AND condition2 AND condition3 ...
GROUP BY k it to the submit form?
And so briefly
1) How to get this request?
2) How will you need to make your custom request using yii2? Where should I put this request in model or in modelSearch ?
3) how to pass it to pjax side submit form?
Answer the question
In order to leave comments, you need to log in
1. Requests are not the responsibility of an entity, but of a separate repository. In Yii, you can make a Query model. For example PostQuery. There and make this request. From PostSearch you call this method.
3. I did not quite understand what the problem is. But if I understood correctly, then you are talking about connections. Use connections.
https://www.yiiframework.com/doc/guide/2.0/en/db-a...
Section "declaring relationships"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question