public function fetchObjects(string $sql, array $params = [], $object = null)
    {
        $stmt = $this->prepare($sql, $params);

        if (\is_string($object)) {
            // fetch to some class by name
            $result = $stmt->fetchAll(\PDO::FETCH_CLASS, $object);
        } else {
            // fetch to StdClass
            $result = $stmt->fetchAll(\PDO::FETCH_OBJ);
        }

        $stmt->closeCursor();
        $this->ok();
        return $result;
    }
public function fetchObjects(string $sql, array $params = [], $object = null)
    {
        $stmt = $this->prepare($sql, $params);

        if (\is_string($object)) {
            // fetch to some class by name
            $result = $stmt->fetchAll(\PDO::FETCH_CLASS, $object);
        } else {
            // fetch to StdClass
            $result = $stmt->fetchAll(\PDO::FETCH_OBJ);
        }

        $stmt->closeCursor();
        $this->ok();
        return $result;
    }
public function fetchObjects ( string $ sql , array $ params = [ ] , $ object = null ) { $ stmt = $ this -> prepare ( $ sql , $ params ) ; if ( \ is_string ( $ object ) ) { // fetch to some class by name $ result = $ stmt -> fetchAll ( \ PDO :: FETCH_CLASS , $ object ) ; } else { // fetch to StdClass $ result = $ stmt -> fetchAll ( \ PDO :: FETCH_OBJ ) ; } $ stmt -> closeCursor ( ) ; $ this -> ok ( ) ; return $ result ; }
Returns an array of objects containing the result set

@param  string $sql    SQL query with placeholders
"SELECT * FROM users WHERE name = :name AND pass = :pass"
@param  array  $params params for query placeholders (optional)
array (':name' => 'John', ':pass' => '123456')
@param  mixed  $object Class name or instance

@return array|false
@throws DbException
Returns an array of objects containing the result set