fetchPairs() with column from other table doesn't work
Closed this issue · 2 comments
TomasVotruba commented
In case I want to get particular user's classroom list from joining table, this returns error:
$result = $this->db->user_classroom->fetchPairs("classroom.id");
Undefined index: classroom.id
This would fix it (last foreach in fetchPairs(). But is it ok?
foreach ($clone as $row) {
$values = array_values(iterator_to_array($row));
$return[$values[0]] = ($value != "" ? $values[(isset($values[1]) ? 1 : 0)] : iterator_to_array($row));
}
vrana commented
It seems that you can use classroom_id
directly in this case.
TomasVotruba commented
Ok. But how to get classroom.name?