YII2 Динамическая реляционная, нетерпещая нагрузка
// 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;
}
Mysterious Macaque