|
|
@ -236,7 +236,7 @@ trait ActiveRelationTrait |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param ActiveRecord[] $primaryModels |
|
|
|
* @param array $primaryModels either array of AR instances or arrays |
|
|
|
* @return array |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private function findPivotRows($primaryModels) |
|
|
|
private function findPivotRows($primaryModels) |
|
|
@ -247,6 +247,10 @@ trait ActiveRelationTrait |
|
|
|
$this->filterByModels($primaryModels); |
|
|
|
$this->filterByModels($primaryModels); |
|
|
|
/** @var ActiveRecord $primaryModel */ |
|
|
|
/** @var ActiveRecord $primaryModel */ |
|
|
|
$primaryModel = reset($primaryModels); |
|
|
|
$primaryModel = reset($primaryModels); |
|
|
|
|
|
|
|
if (!$primaryModel instanceof ActiveRecordInterface) { |
|
|
|
|
|
|
|
// when primaryModels are array of arrays (asArray case) |
|
|
|
|
|
|
|
$primaryModel = new $this->modelClass; |
|
|
|
|
|
|
|
} |
|
|
|
return $this->asArray()->all($primaryModel->getDb()); |
|
|
|
return $this->asArray()->all($primaryModel->getDb()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|