Skip to content

Commit 49f248c

Browse files
committed
- added Select::fetchGroups
1 parent 0153414 commit 49f248c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Kir/MySQL/Builder/RunnableSelect.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ public function fetchKeyValue() {
109109
return $result;
110110
}
111111

112+
/**
113+
* @param array $fields
114+
* @return array
115+
*/
116+
public function fetchGroups(array $fields) {
117+
$rows = $this->fetchRows();
118+
$result = array();
119+
foreach($rows as $row) {
120+
$tmp = &$result;
121+
foreach($fields as $field) {
122+
$tmp[$field] = [];
123+
$tmp = &$tmp[$field];
124+
}
125+
$tmp = $row;
126+
}
127+
return $result;
128+
}
129+
112130
/**
113131
* @return string[]
114132
*/

0 commit comments

Comments
 (0)