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