From 8a4dffed9d2daf1878a3ffca7eb5c813a1ccd720 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Tue, 12 Nov 2013 14:22:07 +0100 Subject: [PATCH] fixed ActiveRelation::__clone() to work with via relation --- framework/yii/db/ActiveRelation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/yii/db/ActiveRelation.php b/framework/yii/db/ActiveRelation.php index ee4fb96..91e21d8 100644 --- a/framework/yii/db/ActiveRelation.php +++ b/framework/yii/db/ActiveRelation.php @@ -55,9 +55,11 @@ class ActiveRelation extends ActiveQuery */ public function __clone() { + // make a clone of "via" object so that the same query object can be reused multiple times if (is_object($this->via)) { - // make a clone of "via" object so that the same query object can be reused multiple times $this->via = clone $this->via; + } elseif (is_array($this->via)) { + $this->via = [$this->via[0], clone $this->via[1]]; } }