|
|
@ -74,21 +74,21 @@ class ActiveFinder extends \yii\base\Object |
|
|
|
$rows = $command->queryAll(); |
|
|
|
$rows = $command->queryAll(); |
|
|
|
$records = array(); |
|
|
|
$records = array(); |
|
|
|
if ($query->asArray) { |
|
|
|
if ($query->asArray) { |
|
|
|
if ($query->indexBy === null) { |
|
|
|
if ($query->index === null) { |
|
|
|
return $rows; |
|
|
|
return $rows; |
|
|
|
} |
|
|
|
} |
|
|
|
foreach ($rows as $row) { |
|
|
|
foreach ($rows as $row) { |
|
|
|
$records[$row[$query->indexBy]] = $row; |
|
|
|
$records[$row[$query->index]] = $row; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$class = $query->modelClass; |
|
|
|
$class = $query->modelClass; |
|
|
|
if ($query->indexBy === null) { |
|
|
|
if ($query->index === null) { |
|
|
|
foreach ($rows as $row) { |
|
|
|
foreach ($rows as $row) { |
|
|
|
$records[] = $class::create($row); |
|
|
|
$records[] = $class::create($row); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
foreach ($rows as $row) { |
|
|
|
foreach ($rows as $row) { |
|
|
|
$records[$row[$query->indexBy]] = $class::create($row); |
|
|
|
$records[$row[$query->index]] = $class::create($row); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -125,10 +125,10 @@ class ActiveFinder extends \yii\base\Object |
|
|
|
$joinTree->createRecord($row); |
|
|
|
$joinTree->createRecord($row); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($query->indexBy !== null) { |
|
|
|
if ($query->index !== null) { |
|
|
|
$records = array(); |
|
|
|
$records = array(); |
|
|
|
foreach ($joinTree->records as $record) { |
|
|
|
foreach ($joinTree->records as $record) { |
|
|
|
$records[$record[$query->indexBy]] = $record; |
|
|
|
$records[$record[$query->index]] = $record; |
|
|
|
} |
|
|
|
} |
|
|
|
return $records; |
|
|
|
return $records; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|