Yii2 Dynamic Relational Query

[Solved] Yii2 Dynamic Relational Query | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : Yii2 Dynamic Relational Query

Answered by : rusik

$customer = Customer::findOne(123);
// SELECT * FROM `order` WHERE `customer_id` = 123 AND `subtotal` > 200 ORDER BY `id`
$orders = $customer->getOrders() ->where(['>', 'subtotal', 200]) ->orderBy('id') ->all();

Source : https://www.yiiframework.com/doc/guide/2.0/en/db-active-record#relational-data | Last Update : Mon, 28 Feb 22

Answers related to Yii2 Dynamic Relational Query

Code Explorer Popular Question For Php Frameworks Yii