本文整理汇总了PHP中yii\db\Query::WHERE方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::WHERE方法的具体用法?PHP Query::WHERE怎么用?PHP Query::WHERE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\Query
的用法示例。
在下文中一共展示了Query::WHERE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClusteringMarkers
protected function getClusteringMarkers($zoom, $lat_max, $lat_min, $lng_min, $lng_max)
{
$number = 0;
$multiplyNumber = 1 / 500 * pow(2.4, $zoom);
$query = new Query();
$query->from('{{%adver}}')->select(["COUNT(*) AS [[adver_count]]", "AVG(latitude) AS [[lat]]", "AVG(longitude) AS [[lng]]", "FORMAT([[latitude]] * {$multiplyNumber} , {$number}) AS [[g_lt]]", "FORMAT([[longitude]] * {$multiplyNumber} , {$number}) AS [[g_ln]]"]);
$query->andWhere(['between', '[[latitude]]', $lat_min, $lat_max]);
$query->andWhere(['between', '[[longitude]]', $lng_min, $lng_max]);
$query->WHERE(['[[status]]' => self::STATUS_ACTIVE, 'lang' => ['*', Yii::$app->language]]);
// adjust the query by adding the filters
$query->andFilterWhere(['[[category_id]]' => $this->category_id]);
$query->andFilterWhere(['[[country_id]]' => $this->country_id]);
$query->andFilterWhere(['[[province_id]]' => $this->province_id]);
$query->andFilterWhere(['[[city_id]]' => $this->city_id]);
$query->andFilterWhere(['like', '[[title]]', $this->title]);
$query->andFilterWhere(['like', '[[address]]', $this->address]);
$query->groupBy(['[[g_lt]]', '[[g_ln]]']);
return $this->mergeBubbles($zoom, $query->all());
}