diff --git a/docs/guide/db-query-builder.md b/docs/guide/db-query-builder.md index 44b612316d..cbd921e8ac 100644 --- a/docs/guide/db-query-builder.md +++ b/docs/guide/db-query-builder.md @@ -351,6 +351,20 @@ Like [[yii\db\Query::andWhere()|andWhere()]] and [[yii\db\Query::orWhere()|orWhe [[yii\db\Query::andFilterWhere()|andFilterWhere()]] and [[yii\db\Query::orFilterWhere()|orFilterWhere()]] to append additional filter conditions to the existing one. +Additionally, there is [[yii\db\Query::andFilterCompare()]] that can intelligently determine operator based on what's +in the value: + +```php +$query->andFilterCompare('name', 'John Doe'); +$query->andFilterCompare('rating', '>9'); +$query->andFilterCompare('value', '<=100'); +``` + +You can also specify operator explicitly: + +```php +$query->andFilterCompare('name', 'Doe', 'like'); +``` ### [[yii\db\Query::orderBy()|orderBy()]] diff --git a/docs/guide/output-data-widgets.md b/docs/guide/output-data-widgets.md index 2827fde20e..bfae3c95d2 100644 --- a/docs/guide/output-data-widgets.md +++ b/docs/guide/output-data-widgets.md @@ -395,9 +395,11 @@ class PostSearch extends Post return $dataProvider; } } - ``` +> Tip: See [Query Builder](db-query-builder.md) and especially [Filter Conditions](db-query-builder.md#filter-conditions) +> to learn how to build filtering query. + You can use this function in the controller to get the dataProvider for the GridView: ```php