setStatement($statement); } protected PDOStatement $statement; public function setStatement(PDOStatement $statement): RSInterface { $this->statement = $statement; return $this; } public function getStatement(): PDOStatement { return $this->statement; } public function execute(array $values): RSInterface { $this->getStatement()->execute($values); return $this; } public function getAsArray(): array { $rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC); if (!$rs) { throw new BlankResult(); } return $rs; } public function getAsObject(): array { $rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ); if (!$rs) { throw new BlankResult(); } return $rs; } public function getFirstAsArray(): array { $rs = $this->getStatement()->fetch(PDO::FETCH_ASSOC); if (!$rs or count($rs) === 0) { throw new BlankResult(); } return $rs; } public function getFirstAsObject(): object { $rs = $this->getStatement()->fetch(PDO::FETCH_OBJ); if (!$rs or count($rs) === 0) { throw new BlankResult(); } return $rs; } }