mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 14:57:23 +08:00
Make sure query cloning works as expected.
This commit is contained in:
@@ -9,7 +9,6 @@ namespace yii\data;
|
||||
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\base\InvalidParamException;
|
||||
use yii\base\Model;
|
||||
use yii\db\Query;
|
||||
use yii\db\ActiveQuery;
|
||||
|
||||
@@ -50,6 +50,16 @@ class ActiveRelation extends ActiveQuery
|
||||
*/
|
||||
public $via;
|
||||
|
||||
/**
|
||||
* Clones internal objects.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the relation associated with the pivot table.
|
||||
|
||||
Reference in New Issue
Block a user