Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Yii2 Dynamic Relational Query

$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 by www.yiiframework.com #
 
PREVIOUS NEXT
Tagged: #Dynamic #Relational #Query
ADD COMMENT
Topic
Name
5+8 =