Skip to content
Advertisement

How do I add a filter on yii2 models

I have a query used to read data from a view. I am then applying a non related sql filter to this, to take out the models I don’t need and then returning an arrayDataProvider instance. The filter I am applying is the promotion period. However, when I pass query params to this search model, it doesn’t work. How do I solve this?

Here’s the code to select data from the view:

JavaScript

Here’s the dump of the params from the URL:

JavaScript

]

Advertisement

Answer

Like i understand, you trying to find all models between specified period if it is set.

Try this:

JavaScript

Documentation for Data Providers

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement