Compare commits
9 Commits
28e31de2a1
...
2.1.1
Author | SHA1 | Date | |
---|---|---|---|
b964bd65fe | |||
cc7cd638e3 | |||
ac9b141928 | |||
758ff0e282 | |||
d5fde83afb | |||
6dda8e1515 | |||
ec19c25681 | |||
6525eb2f31 | |||
6b978c371c |
@ -11,5 +11,10 @@
|
||||
"email": "aldarien85@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {}
|
||||
"require": {},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ProVM\\": "src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,5 +9,6 @@ interface ResultSet
|
||||
public function execute(array $values): ResultSet;
|
||||
public function getAsArray(): array;
|
||||
public function getAsObject(): array;
|
||||
public function getFirst(): mixed;
|
||||
public function getFirstAsArray(): array;
|
||||
public function getFirstAsObject(): object;
|
||||
}
|
||||
|
@ -31,14 +31,34 @@ class ResultSet implements RSInterface
|
||||
|
||||
public function getAsArray(): array
|
||||
{
|
||||
return $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (!$rs) {
|
||||
throw new \PDOException("No results found.");
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
public function getAsObject(): array
|
||||
{
|
||||
return $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
|
||||
$rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
|
||||
if (!$rs) {
|
||||
throw new \PDOException("No results found.");
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
public function getFirst(): mixed
|
||||
public function getFirstAsArray(): array
|
||||
{
|
||||
return $this->getStatement()->fetch(PDO::FETCH_OBJ);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user