Skip to content

Commit

Permalink
check if relationship is empty (LEFT JOIN)
Browse files Browse the repository at this point in the history
if there was a relationship added using a left join
the fields of the joined table may be empty
  • Loading branch information
oakey-b1 committed Jul 21, 2016
1 parent 676f9e0 commit 16821cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framework/Rdo/lib/Horde/Rdo/Mapper.php
Expand Up @@ -253,7 +253,9 @@ public function mapFields($object, $fields = array())
}
}

if (isset($relationships[$m->table])) {
// don't only check the table, if there was a match
// for LEFT JOINs there may be a "empty" result
if (isset($relationships[$m->table], $relationships[$m->table][$m->primaryKey])) {
$object->$relationship = $m->map($relationships[$m->table]);
}
}
Expand Down

0 comments on commit 16821cf

Please sign in to comment.