public function toArrayIndexedBy($field_or_getter)
    {
        $result = [];

        foreach ($this as $row) {
            if ($this->return_mode === ConnectionInterface::RETURN_ARRAY) {
                $result[$row[$field_or_getter]] = $row;
            } else {
                $result[$row->$field_or_getter()] = $row;
            }
        }

        return $result;
    }