| @@ 239-243 (lines=5) @@ | ||
| 236 | return $rows; |
|
| 237 | } |
|
| 238 | foreach ($rows as $row) { |
|
| 239 | if (is_string($this->indexBy)) { |
|
| 240 | $key = $row[$this->indexBy]; |
|
| 241 | } else { |
|
| 242 | $key = call_user_func($this->indexBy, $row); |
|
| 243 | } |
|
| 244 | $models[$key] = $row; |
|
| 245 | } |
|
| 246 | } else { |
|
| @@ 262-266 (lines=5) @@ | ||
| 259 | $model = $class::instantiate($row); |
|
| 260 | $modelClass = get_class($model); |
|
| 261 | $modelClass::populateRecord($model, $row); |
|
| 262 | if (is_string($this->indexBy)) { |
|
| 263 | $key = $model->{$this->indexBy}; |
|
| 264 | } else { |
|
| 265 | $key = call_user_func($this->indexBy, $model); |
|
| 266 | } |
|
| 267 | $models[$key] = $model; |
|
| 268 | } |
|
| 269 | } |
|