Skip to content

Commit

Permalink
Changed out to property exists for better checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammaye committed Feb 27, 2016
1 parent 8af163d commit 8132792
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions EMongoModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,15 @@ public function getRelated($name, $refresh = false, $params = array())

if(!is_array($val) && !is_object($val)){
// continue
}elseif(is_object($val) && isset($val->{$parts[1]})){
}elseif(is_object($val) && property_exists($val, $parts[1])){
$pk[] = $val->{$parts[1]};
}elseif(is_array($val) && isset($val[$parts[1]])){
$pk[] = $val[$parts[1]];
}else{
foreach($val as $k => $v){
if(is_array($v) && isset($v[$parts[1]])){
$pk[] = $v[$parts[1]];
}elseif(is_object($v) && isset($v->{$parts[1]})){
}elseif(is_object($v) && property_exists($v, $parts[1])){
$pk[] = $v->{$parts[1]};
}
}
Expand Down

0 comments on commit 8132792

Please sign in to comment.