always return an array from find_all

This commit is contained in:
Isaac Connor 2018-04-20 14:23:27 -04:00
parent 9de3c44702
commit ac775f13f6
1 changed files with 4 additions and 3 deletions

View File

@ -73,18 +73,19 @@ class Frame {
$file = $backTrace[1]['file']; $file = $backTrace[1]['file'];
$line = $backTrace[1]['line']; $line = $backTrace[1]['line'];
Error("Invalid value for limit($limit) passed to Frame::find from $file:$line"); Error("Invalid value for limit($limit) passed to Frame::find from $file:$line");
return; return array();
} }
} }
$results = dbFetchAll( $sql, NULL, $values ); $results = dbFetchAll($sql, NULL, $values);
if ( $results ) { if ( $results ) {
return array_map( function($id){ return new Frame($id); }, $results ); return array_map( function($id){ return new Frame($id); }, $results );
} }
return array();
} }
public static function find_one( $parameters = array() ) { public static function find_one( $parameters = array() ) {
$results = Frame::find( $parameters, 1 ); $results = Frame::find( $parameters, 1 );
if ( ! sizeof( $results ) ) { if ( ! sizeof($results) ) {
return; return;
} }
return $results[0]; return $results[0];