WIP on new option library
This commit is contained in:
@@ -8,11 +8,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace BitBadger\PDODocument;
|
||||
|
||||
use BitBadger\InspiredByFSharp\Option;
|
||||
use BitBadger\PDODocument\Mapper\Mapper;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use PDOStatement;
|
||||
use PhpOption\{None, Option, Some};
|
||||
|
||||
/**
|
||||
* Functions to execute custom queries
|
||||
@@ -106,7 +106,7 @@ class Custom
|
||||
{
|
||||
try {
|
||||
$stmt = &self::runQuery("$query LIMIT 1", $parameters);
|
||||
return ($first = $stmt->fetch(PDO::FETCH_ASSOC)) ? Some::create($mapper->map($first)) : None::create();
|
||||
return ($first = $stmt->fetch(PDO::FETCH_ASSOC)) ? Option::Some($mapper->map($first)) : Option::None();
|
||||
} finally {
|
||||
$stmt = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user