From bc393ff5d37cb043477bc7280d9d5d7e88b132e8 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 7 Nov 2013 10:38:12 -0500 Subject: [PATCH] added doc about sub-relation. --- framework/yii/db/ActiveQuery.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/framework/yii/db/ActiveQuery.php b/framework/yii/db/ActiveQuery.php index b7fcdcd..99846db 100644 --- a/framework/yii/db/ActiveQuery.php +++ b/framework/yii/db/ActiveQuery.php @@ -182,11 +182,18 @@ class ActiveQuery extends Query * The parameters to this method can be either one or multiple strings, or a single array * of relation names and the optional callbacks to customize the relations. * + * A relation name can refer to a relation defined in [[modelClass]] + * or a sub-relation that stands for a relation of a related record. + * For example, `orders.address` means the `address` relation defined + * in the model class corresponding to the `orders` relation. + * * The followings are some usage examples: * * ~~~ * // find customers together with their orders and country * Customer::find()->with('orders', 'country')->all(); + * // find customers together with their orders and the orders' shipping address + * Customer::find()->with('orders.address')->all(); * // find customers together with their country and orders of status 1 * Customer::find()->with([ * 'orders' => function($query) {