| @@ 72-78 (lines=7) @@ | ||
| 69 | } |
|
| 70 | $models = []; |
|
| 71 | foreach ($rows as $key => $row) { |
|
| 72 | if ($this->indexBy !== null) { |
|
| 73 | if (is_string($this->indexBy)) { |
|
| 74 | $key = isset($row['fields'][$this->indexBy]) ? reset($row['fields'][$this->indexBy]) : $row['_source'][$this->indexBy]; |
|
| 75 | } else { |
|
| 76 | $key = call_user_func($this->indexBy, $row); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | $models[$key] = $row; |
|
| 80 | } |
|
| 81 | ||
| @@ 102-106 (lines=5) @@ | ||
| 99 | if (!empty($result) && $this->indexBy !== null) { |
|
| 100 | $rows = []; |
|
| 101 | foreach ($result as $key => $row) { |
|
| 102 | if (is_string($this->indexBy)) { |
|
| 103 | $key = isset($row['fields'][$this->indexBy]) ? $row['fields'][$this->indexBy] : $row['_source'][$this->indexBy]; |
|
| 104 | } else { |
|
| 105 | $key = call_user_func($this->indexBy, $row); |
|
| 106 | } |
|
| 107 | $rows[$key] = $row; |
|
| 108 | } |
|
| 109 | $result = $rows; |
|