Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Yii2 Dynamic Relational, Eager loading

// SELECT * FROM `customer` LIMIT 100;
// SELECT * FROM `orders` WHERE `customer_id` IN (...)
$customers = Customer::find()
    ->with('orders')
    ->limit(100)
    ->all();

foreach ($customers as $customer) {
    // no SQL executed
    $orders = $customer->orders;
}
Source by www.yiiframework.com #
 
PREVIOUS NEXT
Tagged: #Dynamic #Eager #loading
ADD COMMENT
Topic
Name
1+3 =