| @@ 243-247 (lines=5) @@ | ||
| 240 | return $rows; |
|
| 241 | } |
|
| 242 | foreach ($rows as $row) { |
|
| 243 | if (is_string($this->indexBy)) { |
|
| 244 | $key = $row[$this->indexBy]; |
|
| 245 | } else { |
|
| 246 | $key = call_user_func($this->indexBy, $row); |
|
| 247 | } |
|
| 248 | $models[$key] = $row; |
|
| 249 | } |
|
| 250 | } else { |
|
| @@ 266-270 (lines=5) @@ | ||
| 263 | $model = $class::instantiate($row); |
|
| 264 | $modelClass = get_class($model); |
|
| 265 | $modelClass::populateRecord($model, $row); |
|
| 266 | if (is_string($this->indexBy)) { |
|
| 267 | $key = $model->{$this->indexBy}; |
|
| 268 | } else { |
|
| 269 | $key = call_user_func($this->indexBy, $model); |
|
| 270 | } |
|
| 271 | $models[$key] = $model; |
|
| 272 | } |
|
| 273 | } |
|