Compare commits
1 Commits
2.1.1
...
9ec9fdd731
Author | SHA1 | Date | |
---|---|---|---|
9ec9fdd731 |
@ -11,10 +11,5 @@
|
||||
"email": "aldarien85@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ProVM\\": "src/"
|
||||
}
|
||||
}
|
||||
"require": {}
|
||||
}
|
||||
|
@ -9,6 +9,5 @@ interface ResultSet
|
||||
public function execute(array $values): ResultSet;
|
||||
public function getAsArray(): array;
|
||||
public function getAsObject(): array;
|
||||
public function getFirstAsArray(): array;
|
||||
public function getFirstAsObject(): object;
|
||||
public function getFirst(): mixed;
|
||||
}
|
||||
|
@ -31,34 +31,14 @@ class ResultSet implements RSInterface
|
||||
|
||||
public function getAsArray(): array
|
||||
{
|
||||
$rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (!$rs) {
|
||||
throw new \PDOException("No results found.");
|
||||
}
|
||||
return $rs;
|
||||
return $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
public function getAsObject(): array
|
||||
{
|
||||
$rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
|
||||
if (!$rs) {
|
||||
throw new \PDOException("No results found.");
|
||||
}
|
||||
return $rs;
|
||||
return $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
|
||||
}
|
||||
public function getFirstAsArray(): array
|
||||
public function getFirst(): mixed
|
||||
{
|
||||
$rs = $this->getStatement()->fetch(PDO::FETCH_ASSOC);
|
||||
if (!$rs or count($rs) === 0) {
|
||||
throw new \PDOException("No results found.");
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
public function getFirstAsObject(): object
|
||||
{
|
||||
$rs = $this->getStatement()->fetch(PDO::FETCH_OBJ);
|
||||
if (!$rs or count($rs) === 0) {
|
||||
throw new \PDOException("No results found.");
|
||||
}
|
||||
return $rs;
|
||||
return $this->getStatement()->fetch(PDO::FETCH_OBJ);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user