andFilterWhere
orFilterWhere
$query->andFilterWhere(['or',
['like', 'city', $city_str1],
['like', 'city', $city_str2],
....
['like', 'city', $city_str999],
]);
class Product extends \yii\db\ActiveRecord
{
...
}
class Order extends \yii\db\ActiveRecord
{
...
public function getProducts()
{
return $this->hasMany(Product::className(), ['order_id' => 'id']);
}
...
}
$orders = Order::find()->with('product')->all();
foreach ($orders as $order) {
foreach ($order->products as $product) {
echo 'Order id: ' . $order->id . ' Product Id: ' . $product->id;
}
}