summaryrefslogtreecommitdiff
path: root/src/Database/Db.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-29 18:08:45 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-29 18:11:35 +0200
commit175c335810817ff3e989f368889274d3f09c08b1 (patch)
treeb0a6a68003a1d5c637fcfb956b598f5cb56fac02 /src/Database/Db.php
parent6ee738f82be9a6052f0759aed540d6d09027105b (diff)
Db::selectOne() should return null if result is empty
Diffstat (limited to 'src/Database/Db.php')
-rw-r--r--src/Database/Db.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Database/Db.php b/src/Database/Db.php
index f34d1564..c0871e68 100644
--- a/src/Database/Db.php
+++ b/src/Database/Db.php
@@ -45,14 +45,19 @@ class Db
*
* @param string $query
* @param array $bindings
- * @return array
+ * @return array|null
*/
public static function selectOne($query, array $bindings = [])
{
$result = self::connection()->selectOne($query, $bindings);
// @TODO: remove typecast
- return (array)$result;
+ $result = (array)$result;
+ if (empty($result)) {
+ return null;
+ }
+
+ return $result;
}
/**