diff --git a/~dev_rating/modules/database/classes/Kohana/Database/Result.php b/~dev_rating/modules/database/classes/Kohana/Database/Result.php index f415891bd2ddbb04c271fa1dc5d42a0587bafe94..b371c36fbd03a8ea738e57fba2cc05d668a47eb5 100644 --- a/~dev_rating/modules/database/classes/Kohana/Database/Result.php +++ b/~dev_rating/modules/database/classes/Kohana/Database/Result.php @@ -171,6 +171,18 @@ abstract class Kohana_Database_Result implements Countable, Iterator, SeekableIt return $results; } + public function groupByUniqueKey($key) { + $results = []; + + foreach ($this as $row) { + $results[$row[$key]] = $row; + } + + $this->rewind(); + + return $results; + } + /** * Return the named column from the current row. *