Skip to content

Commit

Permalink
Use foreach instead of array_filter.
Browse files Browse the repository at this point in the history
This allows the loop to be broken on the first non null element.
  • Loading branch information
markstory committed Jul 10, 2014
1 parent 3410911 commit 2c36545
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ORM/ResultSet.php
Expand Up @@ -401,9 +401,13 @@ protected function _groupResult($row) {
if ($assoc['canBeJoined']) {
$results[$alias] = $this->_castValues($target, $results[$alias]);

$hasData = array_filter($results[$alias], function ($v) {
return $v !== null;
});
$hasData = false;
foreach ($results[$alias] as $v) {
if ($v !== null) {
$hasData = true;
break;
}
}

if (!$hasData) {
continue;
Expand Down

0 comments on commit 2c36545

Please sign in to comment.